Text from [ http://2lib.ru ]
@BookId: 11494
@BookInfo:  . .,Delphi 3.0  

.. 

                           Delphi 3.0  .



  


          
.       ""  Basic,
Pascal, .     ?      
.     ,  Pascal  
    .   ,  
     . ,     
 .
    Pascal   ,    
        
   ( - , 
       
  ,   ).   
     Borland,    
       .
    Turbo Pascal,   ,
  ,   Turbo Pascal.
   Turbo Pascal,  Borland   
.      ,  
  ,     
 .    Turbo Pascal 
,    -
.
         
,   Borland    
,    Delphi.
  Delphi -    ,    
Windows.    Delphi   
   - .
   , Delphi 1,    Windows 3.1 (Windows 3.11).
  Windows 95, Borland   16- ,
Delphi 2, ,   , 32- - Delphi 3.
      Delphi   Borland
 Object Pascal,       Turbo
Pascal.  "Object"  ,    
- .

  4________________________Delphi 3.   Object Pascal

     ,     
 Delphi 3    Object Pascal.   
   :    ,
  Windows 95.
       , 
 .       
    . ,  
   ,     . 
   ,     .
   -    .  
  ,    .
    
        
 .
   Courier     , 
 ,   .
   courier italic       
,        
 -      .
,  
ShowMessage()
showMessage -   ,      
 .  -    .  
        -
  , ,  .
      , ,   
      , 
. , Options,  ,   .


  

  ,   ,  . 
         Windows
    ,   
   ,    
Windows,  Borland C++ for Windows,   
,  ,   Delphi, 
   Windows  .
  ()

       Microsoft Visual Basic,  
        Windows.
    Basic    
 ,   ,   .   
    .  ,   Visual
Basic,    -
,      
  .
  Borland Delphi 3 -    ,  
  32-   Windows 95.   
  Delphi 3  - 
Object Pascal.
     Delphi     
   ,   
       
 (,   Windows).


   

        ,
      Delphi.
  ,   ,    
,   ,  , "  "
 , ,  ,  "  " 
.      ,     
       
 , ,  . 
,     .  - 
 ,    .
,   ()   ,
   , ,  ,
" ",       
.
    
 " "      
 ,     
()       .
   -    () , 
      :
      
       
  
 
 
    -    .  
       
 .  ,      .
  ,      ,  
   ax^bx+c^,   :


  8________________________Delphi 3.   Object Pascal

         (, , ) 
 ,       
   
  -   
     ,    

  ,     Windows, 
          .
        
,       ,
 .       ,
, ,     , 
,   ,   
.     .
           
,      .
         ;  
 (  )  .    - 
   .   
.     ,   
  -   .
     ,   ,  
   .     
         ,
, ,    . ,  , 
      ,  
         
   .
    
       
 ,   ,  
 . , ,   
   .    
    .  - 
   ,   ,    
.     , . . 
,       "".
     . 
     . ,


   __________________________________9

      ,    
.
   -   ,    
   .
   ,    ,   
  :
   
 
 
      
     .  ,  
      .
         
 ,      , 
 ,   .
    ,    
    .
        - 
   .
    -   :  -   
; b -    ;  -   
.
    -   ,    Xl
 2.
  :
  1.    (d)   :
  1=-'-4.
  2.       ,  
    :
  - -/d -b+^/d x^=-2a-'' 2= 2 
3.     ,     
  .
       :
  O  (  ,    
,        
 )


  10 Delphi 3.   Object Pascal




    (      ,
  ,     )
  (     -
      ,    
)
     , 
""  " ".     
.     ,  
  , . .   
.
           
    -.  -   
     
.   -: /, /, 
 , -   . 1.
  ,       
    ,   . 2.
      -   
 ,     ,
       .

  . 2. -     


   ________________________________11

           
-      - 
    , 
 .      
 ,    .

  procedure SqRoot(Editi,Edit2,Edit3:tEdit;Label2:tLabel) ;
var
a,b,c:real; (   }
d:real; (  }
xl,x2:real; (   }
begin
{    ) a:=StrToFloat(Editl.text) ;
b:=StrToFloat(Edit2.text) ;
 :=StrToFloat (Edj.t3.text) ;
{   ) d:=Sqr(b)-4*a*c;
if d"0 then begin
Label2.color:=clRed;
Label2.font.color:=clRed;
Label2.caption:=
"  .'+#13+
'   .' end else
begin
(   }
xl:=(b+Sqrt(d))/(2*a);
x2:=(-b+Sqrt(d))/(2*) ;
{   -  ) Label2.font.color:=clBlack;
Label 2.caption:"' :' +#13+'xl=1+FloatToStr(xl)
+#13+'x2='+FloatToStr(x2) ;
end;
end;


  

  ,    ,  . 
  ,  ,    
.        
  ,       
,  .     
    -.


  12 Delphi 3.   Object Pascal

       ,  
     , . .
  .  . 3   
.

  . 3.   

   ,       ,
       . 
       
     .  
         -
       . ,
         
   ,     
  ,     .
    Object Pascal  
  Object Pascal     :
     ,     ,
 .
   
  Object Pascal     :
shortint, smailint,longint,byte, word, integer  cardinal.


    ____ ____ _____ __ __ 13

    shortint, smallint, longint, byte  word   
(fundamental) .      
       
'.
  ,  ,   ,    .
  


shortint
- 128..127
, 8 
smallint
- 32768..32767
,16 
longint
- 2147483648..2147483647
, 32 
byte
0..255
,8 
word
0..65535
,16 

    integer  cardinal    (generic) .
         
    .
  ,  ,   ,    .
  


integer
- 32768..32767
, 16 
cardinal
0..65535
,16 
integer
- 2147483648..2147483647
, 32 
cardinal
0.. 2147483647
, 32 


   

    Object Pascal    ,
   ,  : real, single,
double, extended.       
    , . . . ,  ,
  .

  
real

2.9  -39. 1.7  -"8
- 
11-12
- 

                                6

  single
1.5  -45. 3.4  38

                                7-8

  4
double
5.0  -324.. 1.710"308
15-16

                                8

  extended
3.410-4932..1.1 "4932
19-20

                                10




  14 _____________________Delphi 3.   Object Pascal

   

    Object Pascal    
: ansichar, widechar  char, ,    ,
     .   
   ansichar  widechar.
   ansichar   Ansi-, . . 
()   ,     0  255
(. ).
   widechar   Unicode-,  
  0  65 535.  256  Unicode   
Ansi.
   char         
 Ansi-.
   
  Object Pascal    :
  shortstring, longstring  widestring.
   shortstring      
    0  255 .
   longstring      
 ,      
 .
   widestring      
 ,      
 , ,      longstring, 
  Unicode-, . .  16 .

  ()

   Object Pascal      
 string,      
 Turbo Pascal.  String   shortstring.
   
 Object Pascal  , Boolean,   
: true ()  false ().


  

       .  
  ,    , -


    15

  , .       
 .
         () 
 ,       . ,
     . , 
      
   ,    
.

  . 4.  -   


   -  ,    (. 4). 
,   ,   .   
      ,
    ,     
.      .
   Object Pascal        
,   SUMMA, Summa  summa     
.
  ,        
. ,     
  ,    ''++=, 
      ,   . ,
      , -
 XI  2.  .     ,
, ,       ,
      TotalSurom  Discount  ObSumma
 Skidka.
   Object Pascal      
.       
 ,     ,   
  .


  16 __ ___ Delphi 3.   Object Pascal 
      :

  :;

    -   ;  -     
 Object Pascal.
      .
  :real ;
b:real;
i:integer;
       real   
 integer.
       ,  ,  
 .
        ,    
  ,       
 ,  ,   .
  :
  ,,:1;
1,2:1;

   Object Pascal    :
    .
    -     ,   
 ,  .
         , 
 ,  , ,    .  
         .
  ,     
  "".
      .
  123 0.0 -524.03


           .
         ,  
      ,  

   __________________________________17

    10,   ,   ,
 . ,  ,   , 
 , ,      .
  
 
 
1000000
1106
1.0000000000+06
- 123.452
- 1.23452102
- 1.2345200000+02
0.0056712
5.671210-3
5.6712000000-03

        .  
  .
  '  Object Pascal'
'Delphi 3'
'2.4'
''
      '2.4'.   
,  ,    "  
",    2.4.
   ,   ,    
.       
 :
  =;
  -  ;  -   .
     .
  Hbound=10;
Captions'  ';
pi=3.1415926;
      , 
 ,    .
      . , ,  125 - 
  ,  .  - , '' - 
,  V - .
   
      
.       :
  := ;


  18_______________________Delphi 3.   Object Pascal

    -  ,     
  ;      
"" -    .
  
     .   
.      / .
  ,   . , 
,    Object Pascal   
.
  
+


-


                                *

  
/ DIV
  
MOD
   

        ,  
 DIV  MOD,    .
          
.
   :
  123
0.001 i
+/ Summa*0.75 (1++)/100 Cena MOD 1000
   .    *, /, DIV, MOD 
 ,    +  -.   
      .  
   ,    ,
    .
          
 . :
  (rl+r2+r3)/(rl*r2*r3)


   __________________________________19

  ,   ,    .  ,
          ,
     ,   . '
 ,  ,    ,
. .         .
       
.
   
    ,   , 
  ,   .
         ,   
  ,       .
,  , l  -512  ,   l.o, . , .
2-05 -  .
  ,   ,  .  
,       ,  
     .
    *, +, -.        , 
    ;     , 
   
  I.      
  DIV  MOD.      .
       
  
     : 
  ,    
,      , 
      .
  ,    :
   i:=o; -   i   
 :=+; -     ,   
   
 j :=j+l; -   j   
   ,   
,    ,   , 
. ,   real   
  real  integer,    integer  


  20________________________Delphi 3.   Object Pascal

      integer. , ,   i 
  integer,   d  real,  
i:=n/10;
i:=1.0;
,  
d:=i+l;
.
          
    .    
  ,      .
   
        
Object Pascal   .
   
     . ,
 sqrt    .
       .
  

Abs(n)
  
Sqrt(n)
  
Sqr(n)
 n
Sin(n)
 n
Cos(n)
 n
Arctan(n)
 n
Exp(n)
 n
Ln(n)
  n

    
       ,
    . ,    
 ,     ,  


   __________________________________21

   real,     ,  
 .       FloatToStr,
      ,
   .
        .
  

()
 ANSI   n
IntToStr(n)
,     n
FloatToStr()
,    


   n
FloatToStrF(n,f,.Z,Jn)
,     .  
 :


  f -  ( );


  1 - (   );


  m -     
StrToInt(s)
,     s
StrToFloat(s)
,     s
Round(n)
  n 
Trunc(n)
   n
Frac(n)
   n
Int(n)
   n

   
      .  
    ,   .
,       (d) 
 (1,2)  .
  d:=Sqrt(b)-4*a*c;
xl:=(-b+Sqrt(b*b-4*a*c))/2;
x2:=(-b-Sqrt(Sqrt(b)-4*a*c))/2;
     sqrt  ,  
     sqrt  .
     ,   ,  
  ,      
 ,     .

  22

  Delphi 3.   Object Pascal



   

         ,  
   .
     
        inputBox,
    ,  . 
         inputBox
 :
  :=InputBox(,,);

 -    ,    
   ;
 -    ;
 -   ;
 - ,         
 .
  ,         
     :
  s:=InputBox('-','   ','');
    .    
 (. 5).
  . 5.   
        (  )  
        , QK  Cancel,
 s  :  ,     
, ,      Cancel,  ,
    inputBox    .
      ,    inputBox
 (string) . ,     
 ,    ( )  
       .


   __________________________________23

  ,     funt  (real) , 
,    ,   :
  s:=Inp^itBox('-','   ','');
funt:=StrToFloat(s) ;
    
         
 Text  .
   . 6       
.
  . 6.   
 Editi -   ,     
  ,     ,
        
real,   :
  a:=StrToFloat(Editl.Text) ;
    Text -    ,
,  ,   ,   .
   
      ,   
 ,    .
     
         ShowMessage
  MessageDlg.


  24 _____________________Delphi 3.   Object Pascal

   showMessage        
    .
        showMessage  :
  ShowMessage();
  -   .
  ,  . 7    ,   
 
ShowMessage('    .');
. 7.   
    ,    , 
 ShowMessage,      .
   MessageDig  .      
  Windows,   "", 
    .  . 8   
,     
:=MessageDlg('  '+#13
+'    .', mtlnfonnation,. 8. 
 
 MessageDig   - ,  
  ,      
.
        MessageDig  :
  :" MessageDig{,,,)
 -    .
   -  ,  .    ,
    .   


   __________________________________25

   . ,  ,   ,
  ,   MessageDlg.
  
   
mtWarning
,      
MtError
,     
MtInformation
,   i    
MtConfinnation
 ,      
MtCustom
, ,   

        ,    
    ,  
 .       
  . ,         Cancel
    : 
  
mbYes
Yes
mbNo
No
mbOK
OK
mbCancel
Cancel
mbHelp
Help
mbAbort
Abort
mbRetry
Retry
mbignore
Ignore
mbAll
All

     ,  ,   :
mbOkCancel, mbYesNoCancel  mbAbortRetryIgnore.   
        .
        ,
      "F1"   ,  
   .     
,     MessageDlg   
    .


  26_______________________Delphi 3.   Object Pascal

  ,   MessageDig     
,  ,       .
   ,   .
  
    
mrAbort
Abort
mrYes
Yes
mrOk
Ok
mrRetry
Retry
mrNo
No
mrCancel
Cancel
mr Ignore
Ignore
mrAll
All


      

    ,    , 
    .      .   
  ,     Caption
 . ,  Labeil -      
   ,   ,    
  "    ", 
:
  Labeil.Caption:" '    ';
    caption     
  . ,        
   ,    
    , ,   
FloatToStr  intToStr. ,   ,   
   ,    
  .
  Labeil.Caption:=" ' :'+Chr(13)+
'xl='+FloatToStr(xl)+Chr(13)+ '2='+FloatToStr(2) ;
          
chr,    " ",   
.


   __________________________________27

    Delphi

     Delphi     
 .    
    Delphi.
    Object Pascal     .
   :   .   
   ,    . 
     ,     
,       .
   
  ,    : 
,  ,     .
        :
  Procedure  const
{  } type
(   } var
(   ) begin
{   } end;
     procedure,    
.     ,     
  .     " 
".
       ,    
  ,    const.
        ,  
type.        , 
   ,   . 
    var.    
  .     begin 
  end,     " 

  30_______________________Delphi 3.   Object Pascal
st:= ' '+Chr(13)
+'xl=',FloatToStr(xl)+Chr(13) +'x2=',FloatToStr(x2) ) ;
         
 .  -  ,   
         
.      ,   
    ,   ,   
     .   
  ,      
.
  var
( ) a:real; //    
b:real; //     :real; //   

{  } 1,2:1;


  DELPHI -   

   Delphi
  Delphi   CD-ROM,    
    .   
,   ,      
CD-.
  
   Delphi     
.
           Setup
(. 9),       
       Delphi.
  . 9.   Delphi
     Delphi   
  Welcome (. 10),     
   Next ( ).
      Next    Software License
Agreement (. 11).    , 
   Yes.
    ,      Delphi,
-   Setup Type (,  ) (. 12).   
        Delphi:
Full (), Compact ()  Custom ().
     ,    CD-ROM 
       Delphi 3.


  32 Delphi 3.   Object Pascal

  . 10.   Welcome   Delphi
. 11.   Software License Agreement
        
   Delphi.     
,      
 .   ,   Delphi  
    .
        
    Delphi.    
  .


  Delphi -    33

  . 12.   Setup Type

     100   , 
       ,  
   .
          Next.  
       - 
Select Directories (. 13).
  . 13.   Select Directories


  34 Delphi 3.   Object Pascal

     Select Directories ( )   
 (Space Required)   Delphi   (Space
Available)  ,  ,  
    Delphi.     
,     .
  (  j
   Delphi     
  .
      Next    Select Program
Folder (. 14).
  . 14.   Select Program Folder
   Select Program Folder (  )  
Existing Folders ( )    
 ,    Program Folder ( ) 
 ,      
 Delphi.   Borland Delphi  '  
,     .
       .   
 Next,    Start Copying Files (. 15), 
      :  ,
 ,     Delphi,  
.


  Delphi -   _____________________35

  . 15.   Start Copying Files
  Current Settings ( ),  
,       
Delphi.   -  ,   
 "Back       , 
       .
       ,    
 Install.       Delphi 
CD-ROM    .      
  Delphi,       Setup (. 16)
         
  .
  . 16.   Setup
       
Readme Information (. 17).
      Next  ,  
,   Setup Complete ( ) (. 18).

  36 Delphi 3.   Object Pascal
. 17.   Readme Information
. 18.   Setup Complete

          
  Delphi:  ,    
       ;
  .    
     , 
    Setup Complete   Yes, I want
to restart my computer now (,   ). 
   Finish  

  Delphi -    37
Windows (    ).   
Delphi .     .
   Delphi
Delphi,     Windows,     
   Windows    ,  Delphi 
, ,   .
    Delphi        
, ,   ,  Borland Delphi 3, 
 , -  Delphi 3 (. 19)     
.
  . 19.  Delphi     Windows
  Delphi   ,  Delphi, 
   ,     
 .
     .     
    ,      , 
 (. 20).
  . 20.   /


  38_______________________Delphi 3.   Object Pascal

          (. 21).
  . 21.    
       , 
 Delphi.   Delphi    Program
Files\Borland\Delphi 3, ,   :,    
 :
  "C:\Program Files\Borland\Delphi 3\BIN\Delphi32.exe"
  Delphi    , ,    
   delphi32.exe,    ....
          " 
     (. 22).    
    - ,     ,
,  "Delphi 3".     ,  
  ,  Delphi (. 23).
  . 22.     


  Delphi -    39

  . 23.  Delphi
. 24.     
. 25.     : Delphi 3
,        Delphi, - 
  Delphi.        
  Delphi      
 (. 24).
      : Delphi 3,   ,  
      (. 25)   
 .
     Delphi
    Delphi   (. 26), 
     : , , 
   ,      .
     (. 27)    Delphi,  
  .
   ,   Fonnl   ,  
   .
    ,   Object Inspector  
    .   Delphi   
   Fonnl.


  40 Delphi 3.   Object Pascal

  . 26.     Delphi
/  



   
  . 27.   Delphi

  
   ,   
     ( ,  
 ,   . .),   
.   , ,  (  ),
     ,      
.          .
   
   Delphi   
        
.


  Delphi -    41

     ,   Delphi  
,      - , 
   .
  
 
      ()  Forml.
     : ,   ,
 ,  .     Properties
()  Object Inspector.      ,
  -  .
       caption () - 
Forml  -.       Caption. 
    ,     
-  Forml,   (. 28).
    "Backspase",  
Forml   -.
  . 28.    Caption  
      Height  width,
     .    
 185  290.
  
    ,       
       , 
.
     ,  color (),  
  ,      
.         
,       (. 29).
      ,      ,  
 .       "".
        
  (. 30),   ""   "".


  42 Delphi 3.   Object Pascal



  . 29.      

  . 30.       Font

      Font     
,        
Windows     .
       .  Name 
 ,       .
  ,  ,     
.         
 .
  


 
Name
Form"!
  
Caption
-

Height

                                185

  
Width

                                290

  
Font. Name
Arial
 
Font. Size

                                10


      : Name  size.  
      .
     ,   ,  
 ,    . 31.


  Delphi -   _____________________45

  . 31.       
 
         
   -    .  Windows  
    .     
  -  .
  (  ^
 Delphi  ,  ,    
  ,   ,  
( ).       
.    ,  ,    
,  Object Inspector.
      ,     (. 32)
.   ,     
   ,       . 
      .
    -   
. 32.    
        . 
          
,       ,  
 ,   ,    ,   
   ,    .  
   .
   . 33        
.


  44 Delphi 3.   Object Pascal

  . 33.     -  
 ,    , 
 ().   
   Inspector Object. ,  , 
  ,   .
  

 .        () 
Name
,    -
Text
        
Left
        
Top
 
Height
 
Width
,     
Font
     
ParentFont

  Delphi       . 
  ,      
,     ,   , 
      .  
 .
     ,    ( 
 ),       ,
  ,     ,  
,    .   
.
   ,   ,      
Object Inspector.       
,    ,     
  ,     
   Object Inspector (. 34).

  Delphi -    45

      .   
  .
  Name
Edit-1
Text


  Top

                                48

  Left

                                24

  Height

                                24

  Width

                                121


  . 34.      Object Inspector
        :
  .
  ,   ,  .    
  ,    .   ( 
)        .
    , ,   Object Inspector,
  .
         .  
    .  
         .
         , 
   ,   . 35.
  . 35.     
,  ,    Label l  Label2.
  Name
Label!
  Label2
Caption
       


  AutoSize
false
false



  46_______________________Delphi 3.   Object Pascal

  ()
Name
LabeH
LabelZ
Top

                                8

  96
Left

                                24

  24
Height

                                33

  49
Width

                                209

  121
Wordwrap
true
true
ParentFont
true
false

   ParentFont  Label 2   false,  
Font       Font "",  
  .      
 ,   .   Labell   ParentFont
  .
    Autosize (  )  
true,  Delphi       
   ,     . 
,        , 
 Autosize    false   
 ,   .
         ,    
            
.       ,   
.   ,    ,  
  .     
  Object Inspector     
,     .
  Name
Buttoni
Caption

Top

                                56

  Left

                                184

  Height

                                25

  Width

                                75


           
  . 36.


  Delphi -    47

  . 36.     
    
   ,   . , 
         ,
    .     
-   ,   Windows  .  -  ,
     .  Delphi    
, ,      ondick,   -
 OnDblciick.
  ,  ,    Windows.
  
OnClick
    
OnDblClick
     
OnEnter
  ,      
OnError
,         
    
OnExit
   ,     
OnKeyDown
    .  OnKeyDown  OnKeyPress - 
,  ,     , 
     (    
OnKeyUp)
OnKeyPress
,    ,  
 .       
  "Ctrl". He     "Tab", "Enter", 
 
OnKeyUp
    
OnMouseDown
    
OnMouseMove
   
OnMouseUp
    


  48 Delphi 3.   Object Pascal

       - . ,  
 Ondick,    ,    
   .  Delphi     
  .  ,    
    .
         
   .
     () ,   
  ,       .
   Events ()  Object Inspector.  
    Object Inspector     ,
    ,    -
  (. 37).



  . 37.  Events   
. 38.        


        ,   
  .     
 ,    ,     
 .
      ,     
    .    
  ( Delphi    )  
   (. 38).
  Delphi      . 
      .  
 ,   ,   
-


  Delphi -   _____________________49

    .       
.      - Fonnl, Bottoni -   
,    - click.
  
   ,  begin  end,    Object
Pascal,    .
        Ondick   .
  procedure TForml.ButtonlClick(Sender: TObject);
var
f:real; {    }
k:real; (    } begin
f:= StrToFloat(Editi.Text) ;
k:= f*0.4059;
label2.caption:=Editl.text+' (/)  '+
FloatToStrF(k,ffGeneral,4,2)+ ' (/)';
end;
       Editi,
   Text.  Text   , ,
,      ,  
  StrToFloatF.
          Label2,
   Caption   -  .
    Delphi
  Delphi     
 Object Pascal (begin, end, procedure, const, var  )
,      , 
  .
    ,   .   
   ,   , ,
   ,   .    
   , ,   
,   .
  -  
   -  , 
,     ,  
      .


  50 Delphi 3.   Object Pascal

  ,        
"StrToFloat",      
   ,     
,      ,     
  (. 39).
  . 39.     Delphi
 
         
,   .      
  ,     ,  
        "F1". , 
    real   "",     ,
  . 40.
  .40.     Delphi


  Delphi -    51

   ,        
, ,        
        .
  "     -    Help  
Keyword Search      ,   
   ,  ,    
.
   
  Delphi  -   ,  
    .    ,
       dpr,  
 .   ,      
  (Unit - ).      pas,
   , ,     ,
     .
    ,    File   Save Project As.
       ,      
 Save Project As Delphi     Save Uniti
As (. 41).
  . 41.   Save Unit1 As
     ,    
 Delphi.
  
      Delphi    
    Delphi,      Save
Project As        .


  52 Delphi 3.   Object Pascal

     Delphi   ,    
 .        
 (. 42).
  . 42.    
     ,  ,   
 , , -,   "Enter",  
       .    
     ,  FuntToKg,  
   (. 43).

  . 43.   


          Save Uniti As
    - Save Projecti As (. 44).

  . 44.   Save Projecti As


  Delphi -   ______________________53

          .
    ^)
 ,   ,    
    ,    
    ,      ,
Delphi       : The project already
contains a form or module named... (     ,
 ...).       
    .   ,  
  ,  ,  
  .       ,
,   ,     , 
  - - , ,    
     ,   - 
  ,   .
  
         ,
  Compile   Project,  .  
   ,     
Compiling,     (. 45).




  . 45.    
       
(Errors),   (Warnings)   
(Hints).
    ,    Delphi 
    ,   
       .  
   Compiling   ,   
Tools   Environment Options,    
(. 46)   Preferences    Show compiler
progress,    Compiling and Running,   
 .


  54 Delphi 3.   Object Pascal

  . 46.   Environment Options
  
       
 .       
 ,      
  Compiling,   Errors,   ,
,  ,  .   -    
  ,  .   
       ,
, -    .
       Compiling ,     
 , ,   ,  
 (. 47).
           
.      ,   
   ,      
.           
      Error,    
 ,      .
       ,  , 
,    .    
,    . ,   
(.47)  k:=f*o.4059; ,     
.     ,  -


  Delphi -    55

     f:=StrToFloat (Editl.Text)   
"  ".
  . 47.      
,  ,      .
   
 
Undeclared identifier ( )
-  ,     var ;
-      , , 
 Summa,      Suma: = ....;
-     , ,  const 
conts
Unterminated string ( )
-        
Incompatible types ...and ... ( )
-          
    ,   
Missing operator or semicolon (     )
-        

       ,   
 ,       Windows. 
   ,     ,  - exe.
Delphi      ,    .

  56 Delphi 3.   Object Pascal



     
    ,    ,
   (Hints)   (Warnings).
  ,       
,       (Variable ... is
declarated but never used ...). ,   
   ?
    (Warnings) : Variable ... might not have
been initialized. (, ,    .)
    
       
,     Delphi.    
 Run   Run.
   . 48      
-          
.
  . 48.    -
  -    Windows.    
,     ,     
 .
     
      ,  
     (exceptions).  
      . ,
           
 , , ,  "",     
           
 (. 49).


  Delphi -    57

  . 49.        

         
 .    ,    ,
         
.       ,  
 Windows (. 50).
  , ,    Windows ,    
   -  (    ), 
         ,
,  12.34,    
p:=StrToFloat(Editl.Text)
 ,       Windows
   , ,   strToFloat, 
   . (,  -  
 real, a Editi -      ).
  . 50.   Windows :   


  58 Delphi 3.   Object Pascal

      Delphi,    
        
.       Delphi 
,      (. 51).
  . 51.        Delphi
        ,  
   Run  Step Over.     
  Run  Program Reset.
        
   ,    
   ,     
.
   Delphi        
,    ,   
.
    
    ,    
:   ,   
        .   
          
       Windows.
     ,    Project  
Options, ,     Project Options 
Application (. 52).
    Title ()    . 
,    ,     Windows 
 ,   .


  Delphi -    59

  . 52.  Application   Project Options
   ,      Load
Icon ( ).    Application Icon (. 53),
  ,     
(      ico),     .
  . 53.       
    Application Icon ,  
   Project Options,   
 .       .


  60 Delphi 3.   Object Pascal

      

    Delphi   Image Editor ( ), 
        
.
        ,    Tools 
 Delphi   Image Editor, ,   
 ,   File,   New   
   Icon File.
         Icon Properties
( ) (. 54),      
Windows :  32  32 , 16 .
  . 54.   Icon Properties
        (. 55),  
 ,     Image Editor, 
 .
  . 55.   Image Editor
    Image Editor   
       Microsoft Paint. 


  Delphi -   ______________________61_

    .     ""
(transparent) .      ,  
 ,   ,  ""
,    ,     
.
       , ,  
,    ,    
     (. 56).
  ""
""   Image Editor
 . 56.  Image Editor
  ,  Image Editor  
 .        
   ,     ,  
 , .
      ,     .  
   File   Save,      
 ,    ,    
   .
        ,    .
   
          
     Windows.   
      .
    ^
      .
    ,     Windows  
,  -   .     
       ... (. 57).
          
(. 58).


  62 Delphi 3.   Object Pascal

  . 57.   
. 58.    
           
      .
          
...,         
 .
  
 ""        .

  63 Delphi-  



           "  
     (. 59)   
    .
  KH^cZZI^3^   ' 0 ^^  --^ ^o^aSe^""(tm)  
 1- --
. 59.    
^="^ ^ == s^r^60^
^0^"  0 3"a" "Paa""" ^:
  . 60.     


  64_______________________Delphi 3.   Object Pascal

           
 ,     
    Windows.
     Delphi
 Delphi      - . 
 , ,  ,    
.     Delphi.
            
.
    ^
       dpr.   
  ,    View   Project
Source.
  program FuntToKg;
uses Forms, FuntToKgl in 'FuntToKgl.pas' (Fonnl);
($R *.RES)
begin
Application.Initialize;
Application. Title := '-';
Application.CreateForm(TForml, Formi) ;
Application.Run;
end.
      program,    
,    .   
         
    . ,  
uses,    :   Forms 
  FuntToKgl.
      ( $R* . RES "  , 
   ,    
, , .  ,   
  ,     ,    res.
  (  ^
          
  .       -


  Delphi -   _____________________65_

   , , Resource Workshop.   
   Delphi  Image Editor,    
   Image Editor   Tools.
         begin 
end.       
    .
            
 ,       
   .  Delphi   
 .
            
.
  unit FuntToKgl;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFonnl = class (TFonn)
Label 1: TLabel;
Editi: TEdit;
Buttoni: TButton;
Label2: TLabel;
procedure ButtonlClick(Sender: TObject);
private
( Private declarations } public
( Public declarations ) end;
var
Fonnl: TFonnl;
implementation ($R *.DFM)
procedure TFonnl.ButtonlClick(Sender: TObject);
var
f:real; {    }
d,k:real; (    }
begin
(   } f:=StrToFloat(Editi.Text);


  66_______________________Delphi 3.   Object Pascal

  { ) k:=f*0.4095;
{   )
label2.caption:=Editl.text+' (/) ' +
FloatToStrF(k,ffGeneral,4,2)+ ' (/)';
end;
end.

     unit,     .  
        uses 
 ,     .
      : ,   .
    (  interface)  ,
        . 
     , 
 Delphi   (),    
Type.
    (  implementation)  
 ,   ,   .
      ($R *.DFM}, 
,        
  ,       dfm, 
    .    DFM  Delphi
    .
    ($R *.DFM)     
.         
,       .
        .
      
 begin  end.       ( 
 ),   begin  .
   ,     
 Delphi. , Delphi,    
 ,    .   
,  ,  . ,  Delphi
       .


   

  OBJECT PASCAL


        .
 (),   ,   
 , ,  ,  ,
    . ,   
       ,  
  ,   ,    .
       . 61.
  . 61.    

 -     (Boolean),  
    : "" (true)  "" (false).
          .  
    :
  1  2
: 1  2 -  ,     
, ,   ;  - 
.
     ,   . 
.  
" , true,     ,  false "
, true,     ,  false


  68^_______________________Delphi 3.   Object Pascal

  ()

.  
=
, true,     ,  false

 , true,      ,  false
"=
  , true,       ,
 false
"=
  , true,       ,
 false

     .
   " 1000 Score "= HBound
Sim = Chr(13)
        .
       summa.  
 , ,   true,   
Summa ,  .    Summa   
,      false.
         . 
   true,    score   
  HBound.
          .
    true,    Sim 
   "Enter",  13.
          ,  
     ,    ,  
         . , 
   Key   integer,  
Key = Chr(13)
,     chr    char
().
     ,     
   : Incompatible types (
).
    ,     , 
      ,   ,


    Object Pascal___________________________69

   : NOT - ; AND -  ; OR -
 .
         
  .
  Op1
Op2
Op1 AND Op2
Op1 OR Op2
NOT Op1
false
false
false
false
true
false
true
false
true
true
true
false
false
true
false
true
true
true
true
false

        ,   
   ,   ,   
    .
  ,      
: " ,     100 . 
  - ".       Day
 ,       , 
    :
  (Sumrna " 100)AND(Day = 7)
     ,  
   ,     500 ., 
  :
  ( (Surnma " 100)AND(Day = 7) ) OR (Suinma " 500)

  

           
   if  case.
   IF
         
   if.   :
  if  then
begin


    Object Pascal 71

  else
z:=(rl+r2)/(rl*r2);
        
.
     -    
        
,       :
  if  then begin
( ,   ,
  ,  } end
 . 63   , 
 if-then.


  . 63.  ,   if-then

  , 

  if n=m
then :=+1 ;
       ,  
   m .
       if  
   .  , 
      ,    . 
      , 
  .      ,
     .    
       .
   . 64     .


  70 Delphi 3.   Object Pascal

  { ,   ,
  , . } end else
begin
{ ,   ,    , .
} end
 if   :
  1.    ( - ,  
   true  false).
  2.    (    true), 
     then,   begin 
end.     (    false),
      else ( 
begin  end) .
  
   ()     
,   begin  end  then (else)   .
   . 62   , 
 if-then-else.

  . 62.  ,  
if-then-else


  
  t     
  (t=l   , t=2 -
),   rl  2   , 

if t=l then
z:=rl+r2


    Object Pascal 71

  else
z:=(rl+r2)/(rl*r2);
        
.
     -    
        
,       :
  if  then begin
{ ,   ,
  ,  } end
 . 63   , 
 if-then.


  . 63.  ,   if-then
, 
if n=m
then c:=c+l;
       ,  
   m .
       if  
   .  , 
      ,    . 
      , 
  .      ,
     .    
       .
   . 64     .


  72 Delphi 3.   Object Pascal

  . 64.      

    ( ,   )
  ,     
 -  .       
.
   (,  Name)
 
Edit-1
    
Edit2
   
Label-1, Label2
      
Label3
   -  
Button"!
      

  

Form"!. Caption
 
Editl.Text


  Edit2.Text


  Labell.Caption
 (.)
Label2.Caption
  
Label3. Caption


  Buttoni .Caption


   j
          
 ,    .  
        
, ,    (,   
    ).


    Object Pascal__________________________7.

   ,      , 
       . , 

Form"!. Caption  
,      ,  caption 
     -  " ".

          .
     ondick,   
 .
  procedure TFoml.ButtonlClick (Sender: TObject);
const
PAY=0.15; (    0.15 ! DISCOUNT=20; {
20 ) var
Time:real; {   )
Day:integer; (   }
SuiTOia: real; {   } begin
(  )
Time:=StrToFloat(Editi.Text) ;
Day:=StrToInt(Edit2.Text) ;
(    } Summa:= PAY*Time;
{     ,  
    } if (Day = 6) OR (Day = 7)
then Sunima:=Surnma* (100-DISCOUNT) /100;
{    ) label3.caption:='  '
+FloatToStr(Summa)+'py6.';
end;
         
. , ,     
  ,      : 
()-. ,       : 
   ,     
.
    (     . 65)  
 ,   ,     
  .


  74 Delphi 3.   Object Pascal




  . 65.    
       . 66,  
     .
  . 66.     
    ,      
 (  Buttoni).     
ondick    .
  procedure TFormI.ButtonlClick(Sender: TObject) ;
var
w:real; (  }
h:real; {  }
opt:real; {   }
d:real; (     }


    Object Pascal 75


  begin
w:=StrToFloat(Editl.text) ;
h:=StrToInt(Edit2.Text) ;
opt:=h-100;
if i?=opt then
Label3.caption:='   !' else
if w"opt then begin
d:=opt-w;
Label3.caption:"'  ,  ' + FloatTostr(d)+ '.';
end else begin
d:=w-opt;
Labe13.capt i on:='  ,  + FloatTostr(d)+ ' .';
end;
end;
        
 if,    ""  .  , 
 ,   else,  "  " 
.
   CASE
 case       
 :
  case  of ! : begin
(  1
 ) end;
'2 : begin
(2
 ) end;
 : begin
( 
 } end;


  76 Delphi 3.   Object Pascal


  else
begin
end;
end;

  - ,      
 ( ,    );
   - ,  .  
  ,       
  ,    . , 
1,2,3,4,5,6     l.. 
.
  case n day of
1,2,3,4,5: day:"' .';
6: day:='!';
7: day:='!' ;
end;
case n day of
1..5: day:=' .' ;
6: day:='!' ;
7: day:='!';
end;
case n day of
6: day:='!';
7: day:='!';
else day:=' .';
end;
  case  .  
   case,    
       . 
      ,  
      
 case .       
    ,   
  else.   case    else
   .   , 
          , 
   case  .

  77   Object Pascal



   . 67  - ,  
case.

  . 67. - ,   case


       case  ,
      ,     
  ,  ,     
"" -. ,     405,9 ,  
453,592 ,   ,      500 .
     ,   . 68,   
 .
  . 68.    -
 (ListBox)       ,   
, ,     . , 
,    ListBox.


  78 Delphi 3.   Object Pascal


   
 .       
Name
 
Items
   .      
Item Index
        
Left
        
Top
  
Height
  
Width
,     
Font
     
ParentFont

        
: Items  Itemlndex.
   items   . ,    ,
         ,
   .       
      ,    Object
Inspector   items      
,      (. 69).
  . 69.     Object Inspector
    String list editor (  )
  ,       
(.70).
         
"Enter".          .
   Itemlndex       
 .        ,  
   .


    Object Pascal 79

  . 70.   String list editor

          
.
   (,  Name)
 
ListBoxl
 ,     
Edit1
   
Label1,Label2, Labels
      
Label4
  
Button 1
       

  

Form1. Caption
  Case
Edit1 .Text


  Label 1. Caption
 ,       
Label2.Caption

Labels. Caption

Buttoni .Caption


   ,       
,      ,   


  80_______________________Delphi 3.   Object Pascal

    .     
  .
        ondick   
.
  procedure TFormI.ButtonlClick(Sender: TObject);
var
funt:real; (    ) kg:real; (    } k:real; (
  } begin case ListBoxl. Itemindex of
0: k:=0.4059; (  } 1: k:=0.453592;(  } 2:
k:=0.56001; (  } 3..5,7: k:=0.5; {
,,, ) 6: k:=0.31762; (  ) end;
funt:=St rToFloat(Edit 1.Text) ;
kg:=k*funt;
label4.caption:=Editl.Text
+ ' (/) -  '
+ FloatToStrFtkg,ffFixed,6,3)
+ ' . ' ;
end;
     case.   
       
    . ,   
        
"", ""  "" (123 , 120 , 121 ).
,       
 ,      .
     
 
*0,*5,*6,*7,*8,*9



                                *1

  
*2,*3,*4,


        .   
      11, 12, 13, 14.   
    .


    Object Pascal___________________________81

     ,     Tail
    . ,   
   ,   Tail - .
  i  -  }
(  -      10 )
{ tail -    }
(    } if n " 100
then := mod 100;
if (  "= 11) and (  "= 14) then
tail:=' ' else begin
r:= n mod 10;
case r of
0, 5 .. 9: tail:=' ';
1: tail:=' ';
2 .. 4: tail:=' ' ;
end;
end;
  .    ,  
  (   day (), month
()  year ()),   , , .
      case ,    
  .    -     
28,   :    .
         ( 
   ).   ,   28  
  .  ,    -  
,    - .  ,   
  ,  ,    ,   ,
   .
  {     }
var
day:integer;
month:integer-year:integer-last:boolean;(true     }
:integer; (  ,     year  4 
 }


  82 __________________Delphi 3.   Object Pascal

  begin
(  day, month  year    }
last:"false;
case month of
1,3,5,7,8,10,12:if day=31
then last:= true;
4,6,9,11: if day = 30 then last:" true;
2: if ( day " 28) then begin
r:= year mod 4;
if r "" 0 then last:= true;
end;
end;
if last then
begin (    } day:= 1;
if month = 12 then
begin {   } month:" 1;
year:" year + 1;
end else month:" month + 1;
end else day:" day + 1;
(  day, month  year    ) end;

     ,   
      
  . ,    
,  ,       , 
      ,     ,   
   .  .     
,     ,  ,   . .
  ,      ,    -


    Object Pascal___________________________83

    .      
      .
    ()     
 for, while  repeat.
   FOR
 for ,    ,
,    , ,   
. ,       
 ,        
(   ).
      for   :
  for :=  to    do begin
(  ,     } end
  -  -    ;
_ - ,    -;
_ - ,    -.
  :
  for i:=l to 10 do begin
write('-');
end;
for j:=i+l to n do begin
y:=2*x*x-10;
x:=x+0.5;
end;
  ^
   begin  end    , 
   .


  84 Delphi 3.   Object Pascal


     ,     
  ,    .  
  ,   begin  end, 
 (_ - _ +1) .
  ,   for   . 71. 
,   ,     
  ,     begin 
end     .
  . 71. ,   for

        
  begin  end. ,    
:
  tabl:='';
for i:=l to 5 do
begin
tabl:=tabl+IntToStr(i)+' '+IntToStr(i*i)+chr(13) ;
end;
 tabi      .
       10  :
  1+1/2+1/3+... ( i-ro       
1/i).         ,
   ,      
.
       :   (Labeii) 
  (Buttoni).      
    ondick,    .
  procedure TFoml.ButtonlClickt Sender: TObject);
var
i:integer; (    }


    Object Pascal 85

  elenureal; {    } 1:1; (  
 ) begin
sunra:=0;
labell.caption:='';
for i:=l to 10 do begin
elem:=l/i;
labell.caption:=labell.caption+
IntToStr(i)+' '+FloatToStr(elem)+#13;
surnm: "surnm+elem;
end;
labell.caption:=labell,caption+
' :'+FloatToStr(suiroi) ;
end;
   for   to  downto,   
  ,     , 
.
   WHILE
 while    ,  
  /{ )  
 , ,      
          , .
.   .
      while   
 ,      .
      while   :
  while  do begin
{   } end
   -   .
  ,   begin  end,    , 
  (    true)
,   while,   . 72.
 :
       ,   begin  end, 
    , ,   -

  86 Delphi 3.   Object Pascal


    while    
     , ,  
  begin  end   ,  
 
. 72. ,   while

          
.       ,   
1-1/3+1/5-1/7+1/9+,      ,  
 /4.
      ,   ,   :
  1/(2*-1)     ,     (,
    , ,      
2).   ,     
 ,    .
  . 73.     
      . 73.  
     (Editi).     
 (Buttoni)       
    (Labeii).
      ,     
 ondick,    .
  (       ) procedure
TFonnl.ButtonlClick(Sender: TObject);
var
pi: real; {   " t:real; {  }


    Object Pascal 87


  n:integer; {   } elem:real; (   } begin
pi:=J3;
n:=l';
t:=StrToFloat(editl.text) ;
elem:=t+l; {    } while elem "= t do begin
elem:=l/(2*n-l) ;
if (n MOD 2) = 0 then pi:=pi-elem else pi:=pi+elem;
n:=n+l;
end;
pi:=pi*4;
labell.caption:= '  '+ FloatToStr(pi) + #13
+ ' '+IntTostr(n)+'  .';
end;
 REPEAT...UNTIL
 repeat.. .until,    while,  
,      
( ), ,     
         
 , . .   .
      repeat. . .until   :
  repeat
{  } until 
  -   ,   
.
  :
  repeat
writeln(i) ;
i:=i+l;
until i=10;
repeat
read (n) ;
if n "" 0 then surnm:=sumn+n;
until n=0;


  88 Delphi 3.   Object Pascal


     :
  1.  ,    repeat  until,
 .
  2.
     .    (
   false),     .
   (    true), 
  .
   , ,   repeat  until  
 ,    (    false).
  ,   repeat, .until,   .

                                74.


   :
  D  ,   repeat  until, , 
,  ;
     , ,   ,
  repeat  until,   ,  
 
. 74. ,   repeat..until
      repeat.. .until 
,  :   ,  ,
.  ,   ,     
    . ,     , 
   ,    . .      
 .       ,  
,   ,      .   
,      ,  ,  
  .
        . 75.
  . 75.    


    Object Pascal___________________________89


          .
   (,  Name)
 
Edit-1
 
Label-l
      
Label2
  
Button 1
   

  

Form 1.Caption
 
Edit-l.Text


  Labeh. Caption
  
Label2.Caption


  Buttonl.Caption


   ,    ,   
    .
  procedure TForml.ButtonlClick(Sender: TObject) ;
var
n: integer; (   } d: integer; (  ) r: integer; {
     d) begin
n:=StrTo!nt(Editl.text) ;
d:= 2; {      ) repeat
r:= n mod d;
if   0 { n     d } then d:= d + 1;
until r = 0;
112.caption:=Editl.text ;
if d = n
then iabel2. caption: =label2. caption
+ ' -  .' else Iabel2. caption: =label2. caption
+ ' -  .' ;



  90 ____________Delphi 3.   Object Pascal


   GOTO

   if  case     
     ,    
  .     
     -  
 goto.
      goto   :
  goto 
 -  ,   ,  
    goto.
  ,    goto,      
,    label    
 .
        ,   
   goto.     .
        ,   
    ,    
  ,   goto.
  procedure TForml.ButtonlClick(Sender: TObject);
label (    ) bye;
var
n: integer; (   )
d: integer; (  }
r: integer; {    n  d}
begin
n:=StrToInt(Editl.text) ;
if n "= 0 then begin
MessageDlgt"    .', mtError,Editl.text:= ";
goto bye;
end;
(    } d:= 2; {      }



    Object Pascal__________________________91


  repeat
r:= n mod d;
if r "" 0 ( n     d } then d:= d + 1;
until r = 0;
label2.caption:=Editl.text;
if d = n
then label2.caption:=label2.caption
+ ' -  .' else label2.caption:=label2.caption
+ ' -  .';
bye:
  end;
        
  goto,       .
      .  
  goto  .  , 
goto     ,   
 .


   -


    70- ,  .   Pascal,  
Windows   .    
    MS DOS,    
    ,    - ,
      (,  
 ).   Pascal   ,
     (read  readin)   
   (write  writein).       
  -    Pascal,
,  Turbo Pascal 7.0.
   ,       
Windows,      -
( -    ,    
-).       
         
     
   ,    DOS-.
    ^
 ,    Windows, ,
   -   
  .     ,    
.
   WRITE n WRITELN
 write        
 .   write     
.         -
,    .
  :
  write (Suinma) ;
write(' ');
write(' . 1=',1,' 2=',2);


  94 Delphi 3.   Object
Pascal


          ()
   .
     integer  -   ,  
  (   ). ,  write (d:
5); ,      d  5
.   ,      ,
   ,       
,        
 .
  ,    Kol  integer  15,  
  
write(' :',Kol:5);
   :
   : 15
        
,  .      ,
 -    .     , 
   ,      .
  ,   xl  2  real   13.25 
- 0.3401,     
write('xl=',xl:5:2,' 2=',2:12)
   :
  1=13.25 2=-3.40100-01
  ,   ,    
,          
   (       17 ).
     write      , 
        .
  write      . ,
   
:=-2.73;
write(' ');
write(':') ;
write('=') ;
write(:8:5) ;



   -_________________________________95


     :
   :=-2.73000
 writein    write  ,  
        
 . ,    xi  
- 3.561, 2 -  .345,     
writein('  :') ;
writeln('xl=',x:7:3);
writeln('x2=',x:7:3) ;
'   :
    :
  1"-3.510 2= 10.345-
 READ  READLN
 read       
( ).      :
  read(!, 2, ... ^)
  -  ,      
    .
  :
  read () ;
read(Cena,Kol) ;
   read  : 
         
     "Enter".   "Enter" 
  ,     .
,     read(Temperat)   
  21,   Temperat   21.
    read     . 
          
. ,    ,    - real,   
  read (, , )     :
  4.5 23 0.17
     4.5, -23., -.17.


  96_______________________Delphi 3.   Object Pascal


       ,     , 
       read.
,    
read (, );
read ();
    
10 25 18
    read (, ),     , 
- 25.  read ()     18.
   readin    read ,   
         
     readin,   
    read  readin   
. ,    
readin(,);
read() ;
   
10 25 18
    ,  -25.     
  ,     .
     read  readin   
write,   ,     
. ,      
 :
  writein('  .');
write(' :') ;
readin() ;
write('  :') ;
readin(1);
write(':');
readin(Skidka) ;
  ,   ,      
   ,      read
(readin),      (,  
read  )       .



   -_________________________________97_


   
Delphi    ,     
    read  readin,    
  -  write  writein.   
.
      .    
tile  New Application     :
     (Fonnl)     (Unitl.pas). 
   Delphi   Save changes to Unitl.pas?
(   Unitl.pas?),     "" 
   No.        
Delphi     (Object Inspector),   
.     View    Project Source,
      Projectl.dpr,  
  Delphi    .
       (. 76)   
.
  . 76.    
(  ^
    Delphi, , ,  Windows.
     DOS.  ,  DOS
  ASCII,  Windows - ANSI,   
      .    , 
       
""
      .
    (   ),
      ANSI  ASCII-.
    .



  98______________________Delphi 3.   Object Pascal


     ,      
,         .
  {$APPTYPE CONSOLE) program Projects-uses
Classes;
var
f:real; (    }
wrreal; {    }
k:integer; ( -  }
g:integer; ( -  )
{ w = f*0,4095 = k*1000 + g }
begin
writein('** From pounds to kilograms. ***');
writein('Enter weight in pounds and press "Enter"') ;
write('-" ');
readln(f);
w:=f*409.5; {   -  409,5 . } if w " 1000 then begin
k:=Trunc(w/1000);
g:=Round(w - k*1000);
end else begin k:=0;
g:=Round(w);
end;
write(f:4:2,' pound(s) is '};
if k "= 1 then write (k,' kg ');
writein(g,' gr') ;
write('To continue press "Enter"');
readln;
end. ,
    {$APPTYPE CONSOLE),   
  ,   ,     
    .    
.      
,     .  program 
  ,  ,   , -  
.  uses    



   - 99


    (). ,  var  
  ,  begin -  
 .  end,    , 
"  .
  
,     end,   
,   , .
       , . .
   Project  Compile.
       Run   Run  
 .        
 DOS.  . 77   DOS-,   
 ,   Delphi.
  . 77.  DOS-,     ,
  Delphi
       
,     .  
      "Enter".  
   ( )    
   (,   , 
).
  *** From pounds to kilograms. ***
Enter weight in pounds and press "Enter"
- " 2.5
2.5 pound(s) is 1 kg 24 gr
To continue press "Enter"


    

    ,    
.   Object Pascal   
,       
 .
  
        
ansichar, widechar  char.     
     :    
, ,  ,    , 
"Enter" ("   ").
  (  ^
       
 char.
          
   
: char;
 ..  -    ;
char -     .
  :
  otv:char;
ch:char;
    ,   char  
     .  
 char       ,
   :=     char, ,
  char    - ,  
.



  102_____________________Delphi 3.   Object Pascal


  ,    
1:='*';
2:=1;
 cl     ,  2 -
   cl.
    char       char  
 .    ,   
    (. ),   ''
  ,   '9',  '' - , 
'',  'Z' - ,  ''.    :
  tO'"tr".."(9'".."'A'"'B'".."'Zf"ia'"i'".."'z'
     ,  
 ,    :
  "A'""'"'B'"..."''"('"'a'"''"''"...""'""'""'.
     .       .
    , ,  
 " ",    10.
      ,    ,  
  chr,    , 
     . ,  
  ch:=chr(l0)   ch  
" ".
    chr    #,  
    ...255  ,    
. ,     ch:=#32
 ch   .  #   
  .
       onActivate  
(. 78-),        (Label 1) 
 .  FormActivate   
    .
  procedure TForml.FormActivate(Sender: TObject);
var
st:string; (      )
dec: byte; (   }
i,j:integer; (      }
begin



     103


  dec:=192;
for i:=0 to 15 do {   } begin
dec:=i+192;
for j:=1 to 4 do (   } begin
st:=st+chr(dec)+'-'+IntToStr(dec)+' ';
dec:=dec+16;
end;
st:=st+#13; (      ) end;
Labell.caption:=st;
end;
       - 
 (Labell).      , 
Labeil.Font.Name     ,
 Courier New .        
. 7&-6.
  . 78.  
)    )   

  Object Pascal      :
  shortstring, longstring  widestring.    
         
.   shortstring   , . . 
  ,       
  256.   longstring 



  104______________________Delphi 3.   Object Pascal


  widestring   ,    , 
     .
    J
Object Pascal   string,    Turbo
Pascal.        
  string.
          
   
: srting;
 : string   -    ;
string -     ;
 -   ,   
 ,     .
      :
  name:stringbuff:string;
      ,  ,
    255 , . . 
stroka: string .
      ,  ,
   . ,   
 parol ,  :
  parol:= ' '; .
  
parol:= '1998';
 parol:=i998; ,      
 .
    =, ",", "=,"=  ,   string 
     string    .



    ______________________________________105


       .   
  ,     .  
     ,   
,          . 
   .
   1
 2
 


 


!   2


1   2


 1   2

    ,      
  ,     
 . ,    
first_name:=''' ;
1_:='' ;
ful name:=first name+last name;
 ful_name    .
    Object Pascal    
     .     
 .
   LENGTH
 length   .     -
  .   ( ) - 
,    . ,   

n:=length('') ;
m:=length('   ')
  n  m     20.
   DELETE
 delete    .     
  :
  delete(, ,)



  106______________________Delphi 3.   Object Pascal


    -   ;
 -  ,     ;
 -   .
  ,    
s:=' -' ;
delete(s,7,) ;
  s    .
   POS
       .  
     :
  {,);

 -    ,    
    .
  ,    
:=('','-') ;
     7.      ,
   .
     while,     
    st.
  {   )
while((' ',3t) = 1) and(length(3t) " 0) do delete(3t,1,1);
(     }
   delete (3t, 1,1),    
while   ,       ( 
  pos  ' ,st)  ).   length ^st)
"  ,   ,       .
   COPY
 copy    .     
 copy  :
  copy(,?,)


    ______________________________________707


  
 -   ,  ,  
 ;
 -      ,   
 ;
 -   . ,   

gt:= ' ';
fam:=copy(st,9,6) ;
  fam   .

  

   -   ,     
  ,   .  
       ,
, ,  , .
   
  ,    ,   
   .      
:
  :array  -  -;
array -    Object Pascal, , 
  ;
_  __ -  ,  
    , ,  
 -  ;
 -   .
    :
  temper: arraykoef:arrayname: array   
  .    
  ,     
.      const. ,
  -      :
  const
NT=18; {  } SN=25; {    }



  110______________________Delphi 3.   Object Pascal


  var
team:array     ,   
    (),     .
       . :
  teamd:=koefShowMessage(nametemper    
      :
    
  
   
     
 
 
         
.        
,       for,  
-  for     
  .
  , ,   ,    
team,     :
  procedure TForml.ButtonlClickfSender: TObject);
const
NT=5;
var
team:arrayst:string;
i:integer;
begin
teamteamteam

   111


  teamteam(    } for'i:=l to NT do
st: ==st+IntToStr (i) +' ' +teain (   } ShowMessage(st);
end;
       
    .
   
         
   . ""   
  -       .
      ,   
.  , ,    !
,       , 
   ,    ,    
 .      
:     ( Edit)  
  Memo.
    EDIT
         
,    . 79.
  . 79.     
          
  (23),       
   ,     (17),
         
       .



  112______________________Delphi 3.   Object Pascal


          :
  for i:=l to SIZE do
a SIZE -  ,   ,  -
, Editi -   -, GetSubstr - 
  (   ),   
     (    - 
 ,    ).
  (       } Function
GetSubStr(st:string; (  }
n:integer) (   ) :string; (   '' } var
p:integer ;
i:integer;
begin
For i:=l to n-1 do begin
p:=pos(' ',st);
st:=copy(st,p+l,Length(st)-p);
end;
p:=pos(' ',st); //     if p "" 0
then result:=(st,1,p-l) else result:=st;
end;
          -
 ( ),  GetSubstr  ,  
for,   n-1 ,   , 
   ,      
  .
   ,     GetSubstr 
    ,    ,   
  ,      
 .      ,  
   ,  . ,    
    ,     
   ,     . 
    GetSubstr,    
     -



  __________________________________________113


   .      ,   
        
.
  ( ^      } Function
GetSubStr2(st:string; {  }
n:integer) (   } :string; {   '' }
var
p:integer ;
i:integer;
begin
For i:=l to n-1 do begin
p:=pos(' ',st);
st:=copy(st,p+l,Length(st)-p) ;
//      // ,    while
(pos(' ',st)=l)and (length(st)"0) do delete(st,1,1) ;
end;
p:=pos(' ',st);
if p  
then result:=copy(st,1,p-l) else result:=st;
end;
    GetSubstr     
     ,   
(Editi),   (Buttoni)   (Labeli) (. 80-).
       Ondick   , 
 . SO-6 -    (   ).
  procedure TFonnl.ButtonlClick(Sender: TObject) ;
const
SIZE=5; {   } var
a:arrayi:integer;
st:string;
begin
{        }
for i:=l to SIZE do
a{       } st:=";


  114 Delphi 3.  . Object Pascal


  for i:=l to SIZE do
st:=st+IntToStr(i)+' '+ aShowMessage(st) ;
end;
. 80.     GetSubstr  

   GetSubstr,  ,    
   ,  ,   ,
   ,  ,  
 . ,      .
        GetSubstr, ,   
       ,
  .
  (       } Function
GetSubStr3(st:string; (  )
n:integer) {   } :string; f   '' } var
p:integer;
begin
(      ,    } while (post'
',st)=l)and (length(st)"0) do delete(st,1,1) ;
if n"l then
repeat
p:=pos(' ',st);
if p   then begin
st:=copy(st,p+l,Length(st)-p) ;
//      // ,    }
while (posC ',st)=l)and (length(st)"0) do


   115


  delete(st,1,1) ;
n:=n-l;
end;
yntil (n=l)or(p=0) ;
( st     if n"l
then result:=''
else
begin
p:=pos(' ',st);
if p  
then result:=copy(st,1,p-l) else result:=st ;
end;
end;
,     GetSubstr, 
     .
   ,    
 GetSubst    .  ,  
   ,    .
  // st - ,     Edit  //  -  
, SIZE   // buf - -
(        } i:=l;
repeat
buf:=GetSubstr3(Editl.text,i) ;
if Length(buf)   then a+'  ' +IntToStr(SIZE)+' .');
i:=i+l;
until (i"SIZE) or (Length(buf)=0);
  MEMO
    ,     
   ,    Edit 
  Memo,     
.


  116______________________Delphi 3.   Object Pascal


      Memo.
  

 .        () 
Name
,    -
Text
        
Left
        
Top
 
Height
 
Width
,     
Font
     
ParentFont

     Memo   .   
  Standard  ,     Edit.
     Memo   ,  
     .
   Text  Memo   ,  
   Memo ,    
 10  13 (      ),  
 " ".
    ^
  " "    Memo 
  "Enter".
     i-ro   (i- ),   i-l
   13,     10    
    13    .
         Memo  
 :
  for i:=l to SIZE do
a SIZE -  ,   ,  -
, Memol -  Memo-, GetLine -  
,    ,   
 Memo,     (   -


   117


   -   ,   
 " ").
     GetLine,    ,  
 ,    .  , 
       , 
  .
  (       } Function
GetLine(st:string; {  )
n:integer) {   } :string; (   '' ) var
:integer;
begin
(      ,    } while (posC
',st)=l)and (length(st)"0) do delete(st,1,1);
if n"l then
repeat
p:=pos(#13,st);
if    then begin
st:=copy(st,p+2,Length(st)-p); //  -  :
    13  10
//      // ,    }
while (posC ',st)=l)and (length(st)"0) do delete(st,1,1) ;
n;=n-l;
end;
until (n=l)or(p=0) ;
( st     } if n"l
then result:=''
else
begin
p:=pos(#13,st) ;
if   
then result:=copy(st,l,p-l) else result:=st ;
end;
end;
    GetLine     
      (. 81),  


  118 Delphi 3.   Object Pascal

    Memo (),   (Buttoni)  
(Labell).
  . 81.     
     Ondick   .
  procedure TFormI.ButtonlClick(Sender: TObject);
const
SIZE=5; (   ) var
a:arrayi:integer ;
st:string;
begin
(        }
for i:=l to SIZE do
a{       } st:=";
for i:=l to SIZE do
st:=st+IntToStr(i)+' '+ aShowMessage(st) ;
end;
. 82.       Memo-


  __________________________________________119


   . 82        
    .   Fr_memo  
 ,   Memo-.
    ()  
        
 .
     ()   
:   ,    
  (),    
    .    
 ,     () 
  (),      
()     .
         
    (Editi),   (11  Label2),
       
 ,    (Buttoni),    
    .
       ondick   Buttoni,
 ,      .
  procedure TForml.ButtonlClick(Sender: TObject);
const
SIZE=5;
var
a:arraymin:integer; //   - 
i:integer; //  -   
begin
//   for i:=l to SIZE do
a//   
min:=l; //    
for i:=2 to SIZE do
if a

  120______________________Delphi 3.   Object Pascal

  //  
label2.caption:='  :'+IntToStr(aend;
    TForml.Buttoniciick  
  GetSubstr3.      
 implementation  .
   . 83       
     ,     
     .
  . 83.       

  
      ,  
    . , ,   
    .    
  .
          
.   -    . 
       
 ,          
  .    , 
   .
          . 
    repeat,   
 if        
 found  true,     ' .
 ,     ,  
(found=true),      .  
,    found,    
 .
           . 84.
   .


   121


  . 84.      
      (Buttoni)  
TFonnl.Buttonldick (   ),   
 Editi  ,   Edit2 - . 
 :     .  
   .
  procedure TFonnl.Buttonldick (Sender: TObject);
const
SIZE=10;
var
a:arrayn:integer; (   )
found:boolean; ( true -    
 }
i:integer; (    )
begin
(   } for i:=l to SIZE do
a(     } n:=StrTo!nt(edit2.text) ;
{   ) found: ==false;
i:=l;
repeat
if athen found=true
else i:=i+l;
until (i " SIZE) or (found = true);
if found
then ShowMessage('    '
+IntToStr(i)+#13+' .') else ShowMessage('  
.');
end;


  122 Delphi 3.   Object Pascal


          
 GetSubstr3.  ()    
  implementation,    TForml.ButtonlClick.
  ,          
    ,      
.
         ,    , 
        ,   
 .
         ,  
   . ,  ,  ,
  ,       
.     ,  , 
,      , ,  
 -   .
        .  
( )  , ,  , 
(   sred),       (.

                                85).


  . 85.       


      ,   .
      ,     
  (    verh  sred).
      ,     
 (    sred  niz).
       ,    
 ,     ,   
.       (niz-verh)/2 +
verh.
  -        . 86.

   123


  . 87.       
. 86. -      
       . 87.  
Labels      ,  
     ,  (
 verh, niz, sred)  (    
    ).
      ,      
  , -  (checkBox),  
. ,  ,    CheckBox.
  

 .        
Name
,   
Caption
 ,   .   
( ,  ,  ""), 
Checked=TRUE.     (   ""),
 Checked=FALSE
Checked


  124_____________________Delphi 3.   Object Pascal


  ()


  .     Checked
  ,    .
   : cbChecked (), cbGrayed
(,  )  cbUnchecked ( )
State
,      , 
.  AllowGrayed = FALSE,     
  .  AllowGrayed = TRUE,  
 
AllowGcayed
        
Left
        
Top
    
Height
    
Width
,     
Font
    
ParentFont

          
.
  

CheckBoxl.Name
CheckBoxl
CheckBoxl.Caption
 
CheckBoxl.Checked
True
Label3.AutoSize
False
Label3.Wordwrap
True
Label3.Caption

Label3.Width

                                265

  Label3.Height

                                105


        ondick  
  (Buttoni).      
, ,    , , 
  ,  .

  
(     )
procedure TForml.ButtonlClick(Sender: TObject);
const
SIZE=10;
var
a:arrayverh:integer; {    } niz: integer; ( 
  ) sred:integer; {    )
found:boolean;( TRUE -  
   } n:integer; (     )
i:integer;
begin
(   } for i:=l to SIZE do
aobr:=StrToInt(Edit2.text) ;
verh:=l;
niz:=SIZE;
n:=0;
found:=FALSE;
label3.caption;='';
if CheckBoxl.State = cbChecked
then Label3.caption:='verh'+#9+'niz'#9'sred'#13;
(     ) repeat
sred:=Trunc((niz-verh)/2)+verh;
if CheckBoxl.Checked
then Label3.caption:=label3.caption +IntToStr(verh)+#9 +IntToStr(niz)+#9
+IntToStr(sred)+#13 ;
n:=n+l;
if aif obr " athen niz:=sred-l else verh:=sred+l;
until (verh " niz) or found;


  126 __ ___________Delphi 3.   Object Pascal


  if found
then label3.caption:=label3.caption
+'    ' + IntToStr(sred)+#13' ' +
IntToStr(n)+' .' else label3.caption:=label3.caption
+'    :';
end;
      (. 88) 
 .
  . 88.       
     ,   ,  
 ,        , 
   ,    ,
   .
       
  ,      
,       implementation. 
    -      
     .
  Delphi       
           
 ,        
( uses).
    ,   : ,    
.    File   New   



   127


    New item     - Unit, 
    (. 89).
  . 89.   New Items
       ,  
  Delphi  ,   
.
  unit Uniti;
interface
implementation
end.
      unit,     
(         
 ).
   interface    .   
        
,       ,  
.
    implementation ()    ,
   interface.
      ,    :
GetSubstr3  GetLine.
  unit my_unit;
interface
//     //   ,
  



  128______________________Delphi 3.   Object Pascal


  II        
//   -  
//  
Function GetSubStr3(st:string; (  }
n:integer) {   ) :string; (   '' }
//      
//   -    #13
Function GetLine(st:string; (  )
n:integer) {   }
:string; {   '' }
implementation //     
//         Function
GetSubStr3(st:string; (  }
n:integer) (   } :string; (   '' }
var
:integer;
i:integer;
begin
For i:=l to n-1 do begin
p:=pos(' ',st);
st:=copy(st,p+l,Length(st)-p);
//      // ,    while
(pos(' ',st)=l)and (length(st)"0) do delete(st,1,1) ;
end;
p:=pos(' ',st);
if p  
then result:=copy(st,l,p-l) else result:=st;
end;
(       } * Function
GetLinefst:string; {  }
n:integer) {   } :string; (   '' )
var
p:integer;
begin
(      ,    (



   129


  while (posC ',st)=l)and (length(st)"0) do delete(st,1,1) ;
if n"l th^n
repeat
p:=pos(#13,st) ;
if p   then begin
//  -  :   13  10
st:=copy(st,p+2,Length(st)-p) ;
//      // ,    while
(pos(' ',st)=l)and (length(st)"0) do delete(st,1,1);
n:=n-l;
end;
until (n=l)or(p=0) ;
( st     } if n"l
then result:=''
else
begin
p:=pos(#13,st) ;
if p  
then result:=copy(st,1,p-l) else result:=st;
end;
end;
end.
     , . .   Save  
File.
    ^
        
    , , Units ().
          ,
           
   (     
  Delphi   ).
         . 
TFormi.Buttonlciick    GetSubstr3,  



  130 ________________Delphi 3.   Object Pascal


    my_unit.pa3,       
 my_unit. unit s found_;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, my unit; //  
type
TFormI = class(TForm)
Labell: TLabel;
Editi: TEdit;
Label2: TLabel;
Buttoni: TButton;
Edit2: TEdit;
procedure ButtonlClick(Sender: TObject);
private
( Private declarations } public
( Public declarations ) end;
var
Formi: TFormI;
implementation ($R *.DFM}
(     } procedure TFormI.ButtonlClick(Sender:
TObject);
const
SIZE=10;
var
a:arrayn:integer; {   ) *
found:boolean; ( TRUE -  
   )
i:integer; (    }
begin
{   } for i:=l to SIZE do
a

  131 


  {     } n:=StrToInt (edi.t2.text) ;
(   } found:=FALSE;
i:=l;
repeat
if athen found:=TRUE
else i:=i+l;
until (i " SIZE) or (found = TRUE) ;
if found
then ShowMessage ('    '
+IntToStr(i)+#13+'rioMCK . ') else ShowMessage(' 
 .'it-end;
end.
          ,
    .   ,    Project
  Add to project,     Add to project (.
90)    ,     .
  . 90.   Add to project
     ,     
,   ,      , 
    .    
   ,     
  .
       (. 91)      
  ( USES)   
.


  132 Delphi 3.   Object Pascal


  . 91.        
 
      
,       
 . ,      , 
       :
  SIZE -    .
         
    ,     
()    ,  
.
     ()  ,  
 :
      D   
   
        
  :
       ,    
    ,     
     ,    
    ,     
      



   133


          ,
     . 92.
  . 92.       
 ,      
(Buttoni),        (Editi). 
        
      (Label2).
       onciick   .
  procedure TForml.ButtonlClick(Sender: TObject);
const
SIZE=10;
var
a:arraymin:integer; (     
  i     )
j:integer; {  -,    }
buf:integer; ( ,    -  }
i,k:integer;
begin
for i:=l to SIZE do
alabel2.caption:='';
for i:=l to SIZE-1 do begin
(   -
    nu.n:=i;
for j:=i+l to SIZE do if a


  134 Delphi 3.   Object Pascal


  {   aaa(   ) for k:=l to SIZE do
LabelZ.caption:=label2.caption+'
'+IntTostr(aLabel2.caption:=label2.caption+#13;
end;
LabelZ.caption:=label2.caption+#13+" .';
end;
 . 93        .
  . 93.    
  
       .  
,   ,       , 
  .  ,    
    (),     
-    (),      "
".     ,   
.
   . 94     .  1 
       ,  2 -
         
   .

  . 94.   




   135


   . 95       
.
  . 95.       
 ,    ,   
  (Buttoni).      
 (Editi).   ,    
  ,    Label2   .
  procedure TFonnl.ButtonlClick(Sender: TObject);
const
SIZE=5;
var
a:arrayk:integer; (    }
i:integer; (       }
changed:boolean; ( TRUE,      )
buf:integer; (      )
begin
(   } for i:=l to SIZE do
alabel2.caption:='' ;
(   } repeat
changed:=FALSE ;
for k:=l to SIZE-1 do begin
if a(  k-  k+1-  ) buf:=aaa


  136 ______________Delphi 3.   Object Pascal


  changed:=TRUE;
end;
end;
(   } for i:=l to SIZE do
Label2.caption:=label2.caption
+' '+IntTostr(aLabel2.caption:=label2.caption+#13;
until not changed;
Label2.caption:=label2.caption+#13
+' .' ;
end;
 ,      
        .
   ,       
 . ,   51234,  
   ,     , 
       .  
    changed,   
    FALSE.   (
repeat) ,      
   ( for)      
  , , ,   .
   . 96       
.
  . 96.       
 
         
. ,     
       .


   137


  !
  2

4
1

  ^

  


     ,  ,    .
          
 .       
     :
  zavodi array zavod2 array zavod3 array    
        .
     :
  producti array product2 array product3 array product4 array   
        
 ,   .
     ,    
  .
         :
  :array2.. 2] of 

 -  ; array -    Pascal,
,     - ;
!, !, -2,
2 -  ,   
 , ,   ;
 -   .



  138 __ _______Delphi 3.   Object Pascal


           
:
  product array     12   integer. 
      :
  (1-1+1)*
(2-2+1)
   ,      
.       , 
-  .   product    (
)      ()  .  
    for. ,   
   ,    .
  s:=o;
for i:= 1 to 3 do
for j : = 1 to 4 do
s:=s+product( s     }
     ,    (
 j) ,      i  , 
   .  ,   
 s     
product: product      
       .
   
     
(   , 1998 .).    
  .
  
     (, 1998)

 

  


 3 5 2
 12 9 8



   139


  ()

 

  




                                2

  6

                                2

  

                                6

  5

                                4

  

                                5

  4

                                2

  

                                10

  10

                                5

  

                                9

  6

                                3

  

                                6

  3

                                4

  

                                2

  4

                                6

  

                                2

  2

                                3

  

                                5

  1

                                4


       , 
  ,    
(),     :   
    ,   - ,   -
 .
        . 97.
  . 97.  

 
    ,      
  , - StringGrid ( ),  
   (Additional)   
(. 98).
  . 98.   StringGrid



  740______________________Delphi 3.   Object Pascal


  ,  ,     StringGrid.
  

 .      
Name
 


    
ColCount
  
RowCount
    .    
   ,   (cell) ,  
 i-  
Cells
j -   cells

      .  
         
FixedCols
    . 
FixedRows
        
  


       
Options.goEditing
  
DefaultColWidth
  
DefaultRowHeight
 ,   
GridLineWidth
         
Left
         
Top
  
Height
  
Width
,      
Font
    
ParentFont

         s^ringGrid,
      
    .
  

Name
Tab!
  ColCount

                                6





  ________________________________________141


   
RowCount

                                12



  FixedCols

                                0



  FixedRows

                                1



  Options.goEditing
TRUE


  DefaultColWidth

                                65



  DefaultRowHeight

                                14



  GridLineWidth

                                1




   , ,     
  .      
   cells ,     
    .    
cells,    ,  
  OnActivate (   ),  
    .  ,   
     - .
  procedure TForml.FormActivate(Sender: TObject);
begin
tabi .'Cells


























































































stabl.Cellstabl.Cellstabl.Cellstabl.Cellstabl.Cellstabl.Cellstabl.Cellsend;
   ,    ,
        (suttoni).



  142 _____________________Delphi 3.   Object Pascal


  procedure TFormI.ButtonlClick(Sender: TObject) ;
var
c,r:integer; (      }
s:integer; (     )
:integer; (    }
m: integer; (       }
buf:arrayi:integer; (       }
begin
for r:=1 to tabi.rowcount do (    ) begin s:=0;
(   -  ) for c:=l to 3 do
if tabl.cellsthen s:=s+StrTo!nt(tabl.cells{    }
p:=7*StrToInt(tabl.cells(   } tabl.cellstabl.cellsend;
(   }
for r:=l to tabl.rowcount-1 do
begin
m:=r; (   -  -  ) for i:=r to tabl.rowcount-1
do
if StrToInt(tabl.cellsif r  m then
begin (  -  m-   } for :=0 to 5 do begin
buftabl.Cellstabl.Cellsend;
end;
end;
end



   143


           
   . ,   
,       
 .        
  buf,  ,     ,
     (.     
).       
        .
   . 99     .
  . 99.       
 
   
      
      ,  
  .
            
 ,       
. ,     
day:array     
day    .
           
  ,     () 
  . ,     
tabi:array

  144 Delphi 3.   Object Pascal


   
for i:=0 to N do
sum:=suin+tabl   ,     
.     ,     Delphi,
    ,   ,  
   (. 100).
  . 100.        
  ,  , ,   
 ,   Run   Program Reset.
      Windows,     
 for,      Range check error (
 ) (. 101).
  . 101.  Range check error
. 102.  Compiler
  Project Options

   145
(  ^
        
    .  
    (   Delphi
    ,  
),    Compiler   Project
Options,       Project  Options,
       Runtime errors
 Range checking (. 102).

  
 
  ,     
  .  -    .
         1   
 !
  !=1*2*3*...*(-1)*
    :
  n!=n*((n-l)*(n-2)*...*3*2*l)=n*(n-l)!
  ,          (-1). 
 ,  (n-l) -    n-l  
(-2)  . .
   ,       ,  
        
(n-l), . .     .    
 ,  ,     , 
 .
        .
  (     ) function
factorial(k:integer): integer;
begin
if k = 1
then factorial:= 1 else factorial:=k * factorial(k-1);
end;
 ,         ,
    k  .  
  ,      ,  
    .
   . 103     ,  
  ,    -
(Editi),    factorial.



  148 Delphi 3.   Object Pascal


  . 103.   
      Onciick  
  (Buttoni).
  procedure TForml.ButtonlClick(Sender: TObject);
var
k:integer; // ,    
f:integer; //    k begin
k:=StrTo!nt(Editl.Text) ;
f:=factorial(k) ;
label2.caption:='  '+Editl.Text +'  '+IntToStr(f) ;
end;

  
    factorial    
implementation    TForml.ButtonlClick.
   . 104    .  
,   . 104-,  .
  . 104.     
,    ,   . 104-6
 .   44  !   ,
    44  ,  
     integer, ,  
,     .



  ____________________________________________149


  (  ^
Delphi       
  .   ,   
Compiler   Project Options   
  Overflow checking,    Runtime
errors (. 105).
  . 105.  Compiler   Project Options
 :  
       . 
        . 
   ,  ,    
     .    , 
    .
            - 
,  ,  ,   (. 106).


  . 106.         



  150 Delphi 3.   Object Pascal


         . 
       , 
    .      
  ,   .   ,  
 .          ,
       .
  ,         1   5.
  ,    2.   
,   2 ,     1  
   3.   3   4,  4      6   5. 
 .      6  , 
   ,   5.    ,     
7    5.    .  ,   
     .  ,    
   .
      :   ,  
    ,   ,    .
   ,       
   ()     , . .
  .
      ,    ().
   map1 2 3 4 5 6 7
1234567

  0

                                1

  1

                                1

  0

                                0

  0

  1

                                0

  0

                                0

  0

                                0

  0

  1

                                0

  0

                                1

  0

                                0

  1

  1

                                0

  1

                                0

  0

                                1

  0

  0

                                0

  0

                                0

  0

                                1

  1

  0

                                0

  0

                                1

  1

                                0

  1

  0

                                0

  1

                                0

  1

                                1

  0

        i   j
  
 151


    map    road ()   inci (
include - ).  road      .
         
 , . .  .
   incl     ,    
     .  
   ,      
 .
   . 107   -   
   .

  . 107. -    
     . 108.
    ,   ,  
stringGridi (    ),   
( ) -   Labell.    
       Editi  Edit2.
       (Buttoni).  
Label2, Labels  Labei4     .



  152 Delphi 3.   Object Pascal


  . 108.     
  StringGridl


Name
StringGridl
ColCount

                                11

  RowCount

                                11

  FixedCols

                                1

  FixedRows

                                1

  Options.goEditing
TRUE
DefaultColWidth

                                16

  DefaultRowHeight

                                14

  Options.goEditing
TRUE
ScrollBars
ssNone

         , 
 onActivate,     
StringGridl. cells ,   ,
  . 108.  ,  , 
 ,     .
  procedure TFonnl.FonnActivate(Sender: TObject);
var
i:integer;
begin
//  
for 1:=1 to 10 do
StringGridl.Cells
 153
II   for i:=l to 10 do
StringGridl.Cells//    StringGridl.Cells
        
 TFormi.Buttonldick (   ),   
,    ,   step.
  procedure TFormi.Buttonldick (Sender: TObject);
const
=10;( -  ) var
map:arrayroad:arrayinci:arraystart,finish:integer; (  
  )
found:boolean ;
i,j:integer;
procedure step(s,f,p:integer) ;
var
:integer;!  ,     }
i:integer;
begin
if s=f then
begin
(  s  f  !}



  154 ____________________Delphi 3.   Object Pascal


  found:=TRUE;
Labell.caption:=Labell.caption+#13+':' ;
for i:=l to p-1 do
Labell.caption:=Labell.caption+' '+IntToStr(roadend else begin { 
  } for c:=l to N do
begin (    } if(map(      
  )
then begin
roadincite]:=FALSE;
roadend;
end;
end;
end;(   step )
begin
Labell.caption:='' ;
(   ) for i:=l to N do roadfor i:=l to N do incl(
    SrtingGrid.Cells) for i:=l to N do
for j : =1 to N do
if StringGridl.Cellsthen mapstart:=StrToInt(Editl.text) ;
finish:=StrToInt(EditZ.text) ;
roadstep(start,finish,2);(    }
// ,       if not found
then Labell.caption:='   !';
end;



  _______________________________________155


    TForml.Buttonlciick   StringGridi  
 road   ,     Editi  Edit2
-      .  , 
 Step    ,   .
    Step,    .
   :   
        :
    .   ,  , 
.        .
      .,  
-.       ,  
       ,   
   ;  ,      
 .  ,       ,
        ,  
  ,  ,   
  .
    ,    Step, 
    ,    
 .
  procedure TFonnl.ButtonlClick(Sender: TObject);
const
N=10;( -  ) var
map:arrayroad:arrayincl:arraystart,finish:integer; {  
  }
found:boolean;
len:integer; {   ()  )
c_len:integer; {   ()  }
i,j:integer;
procedure step(s,f,p:integer);
var
:integer;!  ,     } i:integer;



  156 _____________________Delphi 3.   Object Pascal


  begin
if s=f then begin
len:=c len;{     } (  
 } for i:=l to p-1 do
Labell.caption:=Labell.caption+'
'+IntToStr(roadLabell.caption:=Labell.caption
+', :'+IntToStr(len)+#13;
end else
(    }
for c:=l to N do (    }
if (map and((len=0)or( len+mapthen begin (    , 
   }
roadstep(c,f,p+l) ;
incite]:=FALSE;
road len:=c len-mapend;
end;{   step )
begin
Labell.caption:='';
{   } for i:=l to N do roadfor i:=l to N do incl(
    SrtingGrid.Cells) for i:=l to N do
for j:=1 to N do
if StringGridl.Cellsthen maplen:=0; //   ()
  len:=0; //   () 
start:=StrToInt(Editl.text) ;
finish:=StrTo!nt(Edit2.text) ;
road


  ___________________________________________157


  inci// ,       if not found
then Labell.caption:"'   !';
end;
       onActivate  
        
   ,    .



    


            .
   . Pascal    
  ,   .
   
 -   ,   
  .     . 
        
 .
      ,      
 .      . 
     :
  :file of 
:
  res: file of char; (   )
koef:file of real; (    }
f:file of integer; (    }
,      , 
  .       
:
  :Text File
  -   ;
TextFile -  , ,   -  
,   .
   
       . 
          ,
   , . .   . 



  160 _________________Delphi 3.   Object Pascal


      AssignFile,  
   .   AssignFile  :
  AssignFile(var f, :string)
      Windows .   
, . .       ,  
   .      AssignFile.
  AssignFile(f,':\result.txt');
AssignFile(f,'\students\ivanov\korni.txt') ;
fname:=('otchet.txt') ;
AssignFile(f,fname) ;
  
       
 write  writeln.      
 :
  write(, } writeln(,
)
  - ,  ,  
 .
   -    ,  
   .        
 .
  ,   f    TextFile, 
    xi  2     :
  write(f, ' ',1,2);
   write  writeln   ,  
writeln    ,    , 
   " ".
     
      .  , 
 ,  ,  ,    
     .  



    _______________________________________161


        :   
      .   
     .
           :
    (       
)
    
         
,    Rewrite (f),  f - 
  TextFile.
           ,
   ,    Append (f),  f -
   TextFile.
   . 109     -  .
  . 109.    -  
  ,      -
  .        
       5 .
  //       procedure
TForrol.ButtonlClickfSender: TObject) ;
var
f:TextFile;
i:integer;
begin
AssignFile(f,'a:\test.txt');
Rewrite(f) ;
for i:=l to 3 do
writein(f,' ',i) ;
CloseFile(f) ;
end;
        : 
 test.txt.   :



  162_____________________Delphi 3.   Object Pascal


   1  2  3
,        
,    TForml.Buttoniciick  test.
txt      .
  //     procedure TFormI.Button2Click(Sender:
TObject);
var
f:TextFile;
i:integer;
begin
AssignFile(f,'a:Xtest.txt') ;
Append(f) ;
for i:=3 to 5 do
writein(f,' ',i);
CloseFile(f) ;
end;
      test. txt .
  :
   1  2  3  4  5
 ,          
   ,   test. txt     
,   1  3.
    
         
 .    ,  
. ,       
,      (      
  ).   -    
  (  -  ).
      Delphi,      
         
    (. 110).



     163


  . 110.      
    Windows,      
 - (. 111).
  . 111.      


          
  .   ,   
lOResult (Input-Output Result -  -).  lOResult
 0,   -  ;  
 -  . ,     
  -,     .  
        
 -  {$!-},    
 -.      
 ($!+},     -.
   . 112  -     
.     , 
 ,         .
  . 112.       
  ,   :
  AssignFile (f,filename) ;
($1-) Append(f) {$!+) if lOResult   then Rewrite(f);



  164_____________________Delphi 3.   Object Pascal


   

          . 
   close.  close    -
  .   :
  close(f).
   
   ,     . 
       ,  
        (.113).
  . 113.      ""
    Edit2 ( )    Editi (,  
 ).      Edit3.
  (  ^
     Enabled  
(Buttoni)    FALSE.
       TFormi.FonnActivate, 
     .  
   ,     
.        
    ,    .
  procedure TFormi.FonnActivate(Sender: TObject);  begin
AssignFile(f,'a:\weather.db') ;
{$!-} Append(f) ;
if lOResult = 0
then Buttoni.Enabled:=TRUE else


    _________________________________________765


  begin
Rewrite(f) ;
if lOResult = 0
then Buttonl.Enabled:"TRUE else ShowMessage(' 
a:Vweather.db') ;
end;
end;
     (Buttoni)   
   -  weather, db.    
,     , ,   ,  
 .
  procedure TForml.ButtonlClick(Sender: TObject);
begin
if (length(editl.text)=0) or (length(edit2.text)=0) or
(length(edit3.text)=0) then ShowMessage('  .'
+#13+'    .') else writeln(f,editl.text,'
',edit2.text,' ',edit3.text);
end;
       weather, db  
,   :  ,    .
     ,   
   writeln.    ,  ,
  ,    ,   .
      TFormi. Formciose,  
 Ondose,      .
  procedure TForml.FormClose(Sender: TObject; var Action: TCloseAction) ;
begin
CloseFile(f) ;
end;
       f,  
f:TextFiie        .
       weather, db  , ,
:
  2 17 -18 2 18 -10 2 19 0 2 20 4



    


  Pascal         
,     .   
,      TextFile, 
    AssignFile  ,   
 ,     ()   ()
,   read  readln.
   
    ()    Reset,
   -  .   
Reset,    AssignFile    
   .
  ,      .
  AssignFile(f,c:\data.txt) ;
Reset(f) ;
    , . .       ,
     .  , 
      ,  
 ,     ,  ,
    (   ). 
       
    .
        ,      
     ,  

   lOResult.
        lOResult 
   .     
,          
      .
  label bye;



  168_____________________Delphi 3.   Object Pascal


  var
f:TextFile;
fname:stringfname:= 'a:\test.txt';
AssignFile(f,fname) ;
repeat ($!-}
Reset(f); //     ($!+) res:=IOResult ;
if res  
then answ:=MessageDlg('  '+ fname+#13 +'
?',mtWarning, (mbYes, mbNo],0);
until (res= 0) OR (answ = mrNo) ;
if res "" 0 then goto bye;
//   ,    //  
 
bye:


     

         read  readin,  
   :
  read{, ) readin(,
)
  -   TextFile;
 -  ,  .
   
 ,       ,  
. ,  read  readin,   
:         (
  ), ,  ,   
 ,   ,   
 .



    ________________________________________169


    readin  read   ,   
        
 readin      . ,
  data.txt   :
  12 5 98 10 15 5 98 12
    
Procedure Simple;
var
f:TextFile;
,,:integer;
begin
As5ignFile(f,'a:\data.txt');
Reset(f) ;
read(f,a) ;
readin(f,b) ;
read(f,c);
end;
    l2,b-5,c-i5.
            
-   ,   .
,   data. txt     
12  96 10 15  98 12
     readin (f,b)  ,  
 ""       ( integer).
   
         
  . , strokal: string     
 ,      , 
 ,    ,   ,  
   .
        ,    
   ,    
     .
     groups. txt  :
  BeatleS Paul Mc'Cartnev Beetles John Lennon



  170 Delphi 3.   Object Pascal


       ,   
 groups. txt       .
   
   
     
group:stringread(f,group,f name, 1 name)
group='Beatles '
fname:string

  f name='Paul '
1 name:string

  lname='Mc'Car'
group:string
read(f,group,f name, 1 name)
group=
f name:string


  'Beatles Paul Mc'Cartnev'
1 name:string
f name=''
1 name=''
group:stringread(f,group,f name, 1name)
groups'Beatles ' f name='Paul Me''
1 name:string1 name='Cartnev '
group:stringreadin(f,group);
group='Beatles '
f name:stringreadln(f,f name, 1 name)
fname='Beatl'
1 name:string

  1 name='es Pau'

    
     ,    .
     ,   ,
     - .   ,
, :
  250  
1000   
120    
    .   
:   ,       
  ,          ,  .
.      .
    ,    , ,  ,
  ?
         EOF (End Of
File -  ).   EOF   -  .
  EOF  FALSE,     
   , . .   



    ________________________________________171


   .      ,  
EOF  TRUE.
  ( . ^
 EOF      .   
 EOF  TRUE,     ,   
        (  
 ).
     TForml.FormActivate,  
 .      
(.),      -   (Labell),
     .
  procedure (Sender: TObject) ;
var
fname:stringf:TextFile; f   ) incom:integer; ( 
   ) surnm: integer; {   } begin
fname: =' : \incora. txt';
AssignFile(f,fname) ;
{$!-}
Reset(f); (  ) {$!+) if IOResult=0 then begin
suinro:=0;
while NOT EOF(f)do(noKa   ) begin
readin(f,incom) ;
sunro: =summ+incom;
end;
CloseFile(f) ;
label 1.caption:"' : 4-IntToStr(summ);
end else labe11.caption:"'  '+fname;
end;
 :      
 while,     EOF  
,      .    EOF 
,        ,  
   (  ).


   ,
 

         Pascal.
   Pascal     
          .
            
,   , .   
     ,    
.
   
  ,   -   ,
  .
         :
  =(!, 2, ... !)
  -    ;
! -  ,    , 
    .
  :
  TDayOfWeek=(MON,TOE,WED,THU,FRI,SAT,SUN) ;
TColor=(Red,Yellow,Green) ;
(  ^
   Delphi ,     
  (  Type - ).
       ,    .
,



  174 __________________Delphi 3.   Object Pascal


  type
TDayOfWeek = (MON,TUE,WED,THU,FRI,SAT,SUN);
var
ThisDay,LastDay:TDayOfWeek;
  ,    , 
 ,      . ,  
     ,    -
.    Dayofweek :
  MON"TUE"WED"THU"FRKSAT"SUN
     
      .
, 
if (Day = SAT) OR (Day = SUN) then begin
{  ,      } end;
     
if Day " FRI then begin
(  ,      } end;
,  ,    
 ,  ,   , ,
   .
     Delphi     
,   .     
    ,     .
,   :
  type
TDayOfWeek = (MON,TUE,WED,THU,FRI,SAT,SUN);
var
ThisDay:TDayOfWeek;
begin
ThisDay:=1;
if ThisDay = 6 then begin
{   } end;



   ,  _____________________175


   ThisDay:=l ,    ThisDay  
    TDayOfWeek, a ,
   ,    . 
 if  .
  (  ^
 ,     -  
    . ,  
  TDayOfWeek   :
  const MON=0;
TUE=1;
WED=2;
THU=3 FRI=4 SAT=5 SUN=6
 
     , , ,
 , .     
 ,       .
          
, . .    ,   
  .      
 :
  = . . 
  -     ;
 -  ,    
 ;
 -  ,    
 .
  :
  TIndex=0..100;
TRusChar='A'.. '';
       .
        index 
  HBOUND.



  176_____________________Delphi 3.   Object Pascal


  const
HBOUND=100;
type
TIndex=l..HBOUND;
      . ,
:
  type
TIndex=l .. 100;
var
tabi: arrayi:TIndex;
        
.       TMonth   
Tsammer.
  type
TMonth=(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep. Oct, Nov, Dec);
TSairoier=Jun. .Aug;

        
,       . ,
     , , , ,  
 ,     .  
   Pascal  ,  
record ().
   -   , ,   , 
   ,    -  
 , .    
,        . 
 ,   ,   ,  
   .
    
       type.    
  :
   = record
_1:_1;
 2:  2;



   ,  _____________________177


  _:_;
end;
 .  -   ;
record -    Pascal, ,  
   () ;
_-1  _1 -    i-  () .  
 :
  type
TPerson = record
f_name:string1_name:stringday:integer ;
month:integer ;
year:integer;
address:stringend;
TDate = record day:integer;
month:integer-year:integer;
end;
      -, :
  var
student:TPerson;
birthday:TDate;
          ,  
    . , 
ShowMessage(' : ',student.f_name+#13 +': ',student.address) ;
    ,     
-- student.
    -    
 .        
 ,  .   student  
   var  :



  178 Delphi 3.   Object Pascal


  student:record
f name:string1 name:stringday:integer;
month;integer-year: integer;
address:stringend;
 WITH
 with        
  -.      :
  with  do begin
(    } end;

with -    Pascal, ,   
 end     -    
 ;
 -  -. ,    
-
student:record //    f name:string   
   Editi, Edit2  Edit3  ,   
   
"
student.f_name:=Editl.text;
student.1_name:= Edit2.text;
student.address:=Edit3.text ;
 
with student do begin
f_name:=Editl.text;



   ,   179


  1_name:=Edit2.text ;
address:=Edit3.text;
end;
     
    .     
-       ,   ,
        (record). ,

type
person == record
f name:string1_naine: string address:stringend;
var
f: file of person;
 ,      person. 
 ,     
 (AssignFile),   (Append, Reset  Rewrite) -
-         
write  read .
     ()   
    ,     .
      (. 114),    ,
     TMedai.
  . 114.   


  180_____________________Delphi 3.   Object Pascal


       .
  unit _;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TFonnl = class(TForm) //   
Label 1: TLabel;
LabelZ: TLabel;
Label3: TLabel;
Editi: TEdit;
Buttoni: TButton;
LabelS: TLabel;
ComboBoxl: TComboBox;
ComboBox2: TComboBox;
RadioGroupl: TRadioGroup;
Label4: TLabel;
procedure FonnActivate(Sender: TObject) ;
procedure FonnClose(Sender: TObject; var Action: TCloseAction);
procedure ButtonlClick(Sender: TObject);
private
( Private declarations ) public
( Public declarations } end;
//   TKind=(GOLD,SILVER,BRONZE) ;
//   TMedal=record
country:stringsport:stringperson:stringkind:TKind;
end;
var
Fonnl: TFonnl;
f: file of TMedal;
iinplementation


   ,  _____________________181


  {$R *.DFM)
procedure TFonnl.FormActivate(Sender: TObj ect) ;
var
resp*: word;
begin
AssignFile(f,'a:\medals. db') ;
{$!-}
Append(f); //     {$!+} if lOResult = 
then buttoni.enabled:=TRUE else begin resp:=MessageDlg('  
 .'+
'  ?', mtlnformation, if resp = mrYes then begin ($!-}
rewrite(f);
($!+} if lOResult = 0
then buttoni.enabled:=TRUE else ShowMessage('   .');
end;
end;
end;
procedure TFonnl.ButtoniClick(Sender: TObject);
var
medal: TMedal;
begin
with medal do begin
country:=ComboBoxl.Text ;
sport:=ComboBox2.Text;
person:=Editl.Text ;
case RadioGroupl.Itemlndex of 0:kind:=GOLD;
l:kind:=SILVER;
2:kind:=BRONZE;
end;
end;
write(f,medal);
end;


  182__________________Delphi 3.   Object Pascal


  procedure TFormi.FormClose(Sender: TObject; var Action: TCloseAction);
begin
CloseFile(f);
end;
       TFormi. FormActivate.
        
TFormi.Buttoniciick,       
(Buttoni).  country  sport     
Text    (comboBoxl)   
(ComboBox2).
    ^)
       items  ComboBoxl
 ComboBox2       .
   person     (Editi).   medal
    RadioGroupi.
        TFormi. Formdose.
     TMedai    (TFormi. FormActivate
 TFormi. Buttoniciick),       type 
.    f      
    .
         .
       
    ,   ,
    (. 115).
  . 115.       
   ( )   Memol,
     .


   ,  _____________________183


  

Name
Memol
Scrol'i.Bars
ssVertical
Readonly
True

           ,
        (Buttoni).
  procedure TFormI.ButtonlClick(Sender: TObject);
type
//  
TKind=(GOLD,SILVER,BRONZE) ;
//   TMedal=record
country:stringsport:stringperson:stringkind:TKind;
end;
var
f:file of TMedal;
rec .TMedal;
n:integer; (    ) st:stringbegin
AssignFileff,'a:\medals.db') ;
($!-}
Reset(f); //     ($!-) if-lOResult "" 
then ShowMessage('   .') else begin
//   buttoni.enabled:=FALSE;
n:=0;
while not EOF(f) do begin
read(f,rec) ;
if rec.country = Editl.Text then begin
if n = 0
then Memol.Lines.Add('*** '+Editl.Text+' ***');



  184_____________________Delphi 3.   Object Pascal


  n:=n+l;
case rec.kind of GOLD: 5t:=' ';
SILVER:st:=' ';
BRONZE: st: =' ' ;
end;
st:=st+rec.sport+' '+rec.person;
Memol.Lines.Add(st);
end;
end;
CloseFile(f);
if n = 0
then ShowMessage('       '+Editl.Text);
buttoni.enabled:=TRUE ;
end;
end;
        
.      , 
 country    ,    
 (Editi)  ,      
Memol.        Memo I. Add
(st),      Add () 
 Memol.
  (  ^
 ""    ,  , 
- .   , 
 -  ,     
   ,       .
    
        ,  , 
     .     
     ,  
    (   - 
).    . ,   
       ,    
 , ,   ,  
  ,   ,   
    .  ,    
   ,  



   ,  _____________________185


     ,     , 
    (     
  ).
  ^  ,     
,      .
  -
    ,   ,
        .
-    ,   
  (. 116).


  . 116. -


  -,     ,  
    .    
--  :
  : "
  -  -;
 -  ,     -
.
    ,    - .
     -:
  pi: ^integer;
p2:real;
 pi -      integer, p2 - 
  real.
      -     , 
  NIL.   () NIL
    -,   
  .  NIL    
   . ,   pi  p2  
,  
pl:=NIL;
  ,  


  186 ___________________Delphi 3.   Object Pascal


  if p2 = NIL
then ShowMessage(' 2     !');
 ,   p2  NIL.
         ,  
     . ,  
pi  p2      integer,   
 
2:=1;
1  p2       .
      ,    ,
   . ,      i,  
  
":=5;
  i   .     /\
,     ,  
 -.
   
   ,   
    .
        
 new.   new   -   
 ,     . ,   
    real,     
new(p),     real    
- .
      ,      
  .
  ,   ,   
     *  , 
 ,   .  
,   ,  
Dispose,     -   
.
  ,   -    ,  
   new(p),   dispose () 
   .


   ,  _____________________187


     ,   
 .
  procedure TFormI.ButtonlClick(Sender: TObject);
var
pl,p2,p3:'''integer; //     integer begin
//     integer
new (pi) ;
new(p2);
new(p3);
pl^^StrToIntfEditl.Text) ;
pS'^StrToInttEd^.Text) ;
p3/^:=pl/\+p2'^;
ShowMessage('    '+IntToStr("));
//    dispose(pi);
dispose(p2);
dispose();
end;
    .  ,  
 pi  p2,      (Editi 
Edit2).        .
   
      
  ,      .

       (. 117).
  . 117.    
   ()   ,   
.   - .     
,    ,  . ,  
     ,  .
      ,    
  -    .  
   :


  188 Delphi 3.   Object Pascal


  type

  TPStudent^TStudent; //     TStudent
(     } TStudent=record
sumame:string{  } {   } (   }
{   )
:stringgroup:integer;
address:stringnext:TPStudent ;
end;
var

  head:TPStudent; (      }
    ,       . 
     .  . 118
       .

  . 118.    


      ,    
.      (Editi  Edit2) 
 (.119)        (Buttoni)
  .
  . 119.      1



   ,  _____________________189


        
TForml.Buttoniciick,    - -
    -     , 
   head.
  procedure TForml.Buttoniciick(Sender: TObject);
var
curr: TPStudent; // ,    begin
new(curr); //    
curr".rename:"Edit 1.Text ;
curr".1_name:=Edit2.Text ;
//    
curr".next:=head;
head:=curr;
Editl.text:='';
Edit2.text:'';
end;
 TForml.Button2dick,      
,     ,    
head,       ,  
 next       NIL.
  procedure TForml.Button2dick (Sender: TObject);
var
curr: TPStudent; //    n:integer; //  (-
)  st:string; //    begin :=0;
st:=";
curr: "head;
while curr "" NIL do //     begin n:=n+l;
st:=st+curr".f_name+' '+curr".1_name+#13;
curr:"curr".next ;
end;
if n  
then ShowMessage(':'+#13+st) else ShowMessage('  
.');
end;
 head   TStudent   ,  




  190 Delphi 3.   Object Pascal


  type
TPStudent="TStudent; //   TStudent
TStudent = record
f_name:stringl_name: string(20]; // 
next: TPStudent; //    end;
var
head: TPStudent;
//  () 
    implementation   
 .
   ,  .     
    . ,    
    ,  .
       ,   ,  
   ,      
,       ,   
 (. 120).


  . 120.     


      2  , 
  "".       . 121.
  . 121.      2


   ,  _____________________797


       (Editi  Edit2)    
  (Buttoni)     ,  
    "".    
   TFonnl .Buttoniciick.
  procedure TFornu.ButtonlClick(Sender: TObject);
var
node: TPStudent; //    curr: TPStudent; //  
 pre: TPStudent; // ,  curr,  begin
new(node); //     nodeA.f_name:=Editl.Text ;
node".1_name:=Edit2.Text ;
//    
//         curr:=head;
pre:=NIL;
( !
        (node. f_nanie"curr". f_name)
and (currONIL),     (node.f name"curr".f name) 
       ,  
curr = NIL , ,  curr."name !
        ,   
  (curr  NIL),   FALSE,  
     . )
while (curr  NIL)and(node.f_name " curr".f_name) do begin
//     pre:= curr; '
curr:=curr".next; //   end;
if pre = NIL then begin
//      node".next:=head;
head:=node ;
end else begin
//    pre,  curr node".next:=pre".next;


  192 Delphi 3.   Object Pascal


  pre .next:=node ;
end;
Editl.text:='';
Edit2.text:='';
i
end;
 TForml.Buttonlciick   -,
    -     ,
         next
,       , '  
 .
     ,     
 (Button2).
  procedure TFonnl.Button2Click(Sender: TObject);
var
curr: TPStudent; //    n:integer; //  (-
)  st:string; //    begin :=0;
st:=";
curr:=head;
while curr "" NIL do begin n: =n+l;
st:^st+curr".f_name+' '+curr.1_name+#13 ;
curr:=currA.next ;
end;
if n  
then ShowMessage(':'+#13+st) else ShowMessage('  
.') ;
end;
        head 
   implementation,   .
  type
TPStudent=^TStudent; //   TStudent
TStudent = record
f name:string1_name: string next: TPStudent; //  
 end;

   ,   193
head: TPStudent; //  () 
 ^     , ,  
: , , , ,  
,    . 122.
  . 122.   ,  
  ,     , 
    (. 123).

  . 123.    


   -   ,    ; ,
    ,   ,  
.   , ,   ,
 ,    dispose.  
dispose   -   , , 
,   . ,  :
  var
 ^integer;
begin
new(p) ;
{    )
dispose(p) ;
end
  ,   . 
    .    , ,
, -     -  
      .



  194 Delphi 3.   Object Pascal


         
.      . 124.
  . 124.      3
       ,    
          
    ,    
.      , 
      (Buttons).
  procedure TForml.Button3Click(Sender: TObject);
var
curr:TPStudent; // ,   pre: TPStudent; // 

found:boolean; // TRUE - ,   ,    begin
if head = NIL
then MessageDlg(' !',mtError,curr:=head;
pre:=NIL;
found:=FALSE;
//  ,    while (curr "" NIL) and (not found) do
begin
if (curr^.f_name = Editl.Text) .
  and (curr^.l_name = Edit2.Text) then found:=TRUE //   
else //    begin
pre:=curr;
curr: "^curr^. next ;
end;
end;


   ,   195


  if found then
begin //   if pre = NIL
then head^curr".next //    else pre^.next:=curr.next;
dispose(curr) ;
Editl.Text:=";
Editl.Text:='';
end
else // ,   ,    01(''+#13
+':'+Editl.Text+#13 +':'+Edit2.Text+#13 +'   .'
,mtError,end;
        
       .  
 ,        
   .  ,   ,  
,      .


  
 - 


    ,      
 ,  ,   
 ,   .
  -  () -   
,      ,   ,
   ,  . ,  
  ,      
 ,         
   .
  (  ^
 ,  ,     Delphi  
   ,    
 .      , 
   ,    Delphi  
 ,     .
  
  Pascal    
    -  (records). Object Pascal,
  - , 
  .  -   ,  
       ,  
     - .
      :
  TTPerson=class private
fname:stringfaddress:stringpublic
procedure show;
end;



  198_____________________Delphi 3.   Object Pascal


     ,    - . 
  TTPerson -   , fname  faddress - 
, show -  .
    ^)
   Delphi      
 f (  field - ).
           (type).
  
    - ,    var.
, :
  var
student:TTPerson;
professor:TTPerson;
     ,   Object Pascal  - 
 . -   ,   
 .       
  .
          -
,     create (). 
     ,    
 procedure   constructor.   
 TTPerson,     .
  TTPerson = class private
fname:stringfaddress:stringconstructor create; //  public
procedure show; //  end; .
         
  -   () .
,   
professor:=TTPerson.create;
      professor .


    - ______________199


    , ,  ,  
    , . . 
 .      
 TTI^erson.
  constructor TTPerson.create;
begin
fname:='';
faddress:='' ;
end;
   . -,   
   New,    
(       ).
-, ,    ,   
      -.
        , ,
   .     
     ,     
.    ,      
 ,     , 
,    ,    . ,
    fname  professor 
professor^.fname
  professor.fname
,         .
         ,  
 ,    .   
  - free. ,  
    professor,  
professor.free ;

  (  ,     
)     .    ,
      ,      .
, 
professor.show;



  200_____________________Delphi 3.   Object Pascal


     show   professor.  
    -     
 .
         ,   
 ,   ,     , 
,    :  ,   
,   .       .
       show   
TTPerson.
  //  show  TTPerson procedure TTPerson.show;
begin
ShowMessage(':'+fname+#13+':'+faddress) ;
end;
    ,       
     .
     
        
      .
   Object Pascal        
 .'    , 
 ,   ,    
.       
 (write),      
  (read).
          property
().      ,   ,
    .   read 
 ,   ,   write - 
  .      TTPerson,
  : Name  Address.
  type
TName=stringTAddress''stringTTPerson = class private
FNaine:Tname; //  - Name



    - ______________201


  FAddress:TAdress; //  - Address Constructor Create
(Name:Tnan"e);
Procedure Show;
. Function GetNaine:TName;
Function GetAddress:TAddress;
Procedure SetAddress(NewAddress:TAddress);
public
Property Name: Tname read GetName;
Property Address: TAddress read GetAddress write SetAddress;
end;
        
       , 
     . ,
    Adress  student, 

student.Address:= '., . 21, .';
     
    
student.SetAddress('., . 21, .');
        
  .        
  :     
   ,   
.
          
. ,      
  ,   , 
  , ,   .
          
,    ,    
.        , 
       .  
 ,    ,  
 .      TTPerson 
Name    ,   Address -    .



  202_____________________Delphi 3.   Object Pascal


    ,   ,   
 .     TTPerson,
     per son     .
  //  TTPerson Constructor TTPerson.Create(Name:TName) ;
begin
FNanie:=Name;
end;
//     Name Function TTPerson.GetName;
begin
Result:=FName;
end;
//     Address
Function TTPerson.GetAddress; 
begin
Result:=FAddress ;
end;
//     Address Procedure
TTPerson.SetAddress(NewAddress:TAddress) ;
begin
if FAddress =''
then FAddres s:=NewAddres s;
end;

     TTPerson    
  FName,    Name.
   ,      
  ,  , , :
  student:"TTPerson.create('') ;
student.address:='. , ., .25';

 -  
      , 
     .    
  .   , , 
()      , 
.



    - ______________203


    -   . , 
TEmployee ()       
    Department ().  
TEmployee      :
  TEmployee = class(TTPerson)
FDepartment:integer; //  
constructor Create(Name:TNanie;Dep:integer) ;
end;
     TTPerson ,   TEmployee
    TTPerson.   ,  TTPerson
    TEmployee.
   TEmployee    ,  
     .   
  TEmployee:
  constructor TEmployee.Create(Name:Tname;Dep:integer);
begin
inherited Create(Name);
FDepartment:=Dep;
end;
    inherited  
 ,      .
          
    .    ,
  .
  engineer:=TEmployee.create('',413);
engineer.address:='., .8, .10';
     TEmployee.  
 ,     .
   Protected Private
    (, , ) 
,  ,   Protected ()  private
(),       
.
   ,    protected,   
   .      -



  204_____________________Delphi 3.   Object Pascal


     ,     . 
  protected    .
   ,    private,   . 
     ,    .
   private    ,  ,
    ,    protected.
      ,    
 .
  TTPerson = class private
FName: TName; (  - Name } FAddress:TAddress; ( 
- Address) protected
Constructor Create(Name:TName);
Function GetName: TName;
Function GetAddress:TAddress ;
Procedure SetAddress(NewAddress:TAddress) ;
Property Name:TName read GetName;
Property Address:TAddress read GetAddress write SetAddress;
end;
  ^)
       ,  
     .
     
 -       ,
   .    
       , 
  .
     ,        .
  type
//   TPerson=class
fname:string;(  )
constructor Create(name:string);
function info: string; virtual;
end;



    - ______________205


  //    TPerson TStud=class(TPerson)
fgr:integer; {   }
constructor Create(name:string;gr:integer) ;
function info: string; override;
end;
//    TPerson TProf=class(TPerson)
fdep:string; {   }
constructor Create(name:string;dep:string);
function info: string; override;
end;
       info.     
 virtual  info  .  
      
   .     
  info,     
 (  ,   
 ,   override).  
  info   .
  function TPerson.info:string;
begin
result:"'' ;
end;
function TStud.info:string;
begin
result:=fname+' rp.'+IntTostr(fgr) ;
end;
function TProf.info:string;
begin
result: =fnaine+' .'+fdep;
end;
        
TPerson. list:array(  ^
  ,   -  .



  206_________________ Delphi 3.   Object Pascal


       ,  Object Pascal 
        
.    list     
TStud,     Tprof.
        info  
, , :
  st:=";
for i:=l to SZL do // SZL -  - if listthen
st:=st+info.listShowMessage(st) ;
         
  TStud,     Tprof.  
     ,  
 .
   . 125    , , 
    , TStud  Tprof,  
    .
  . 125.    
unit polimor_;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFonnl = class(TForm) Editi: TEdit;
Edit2: TEdit;
GroupBoxl: TGroupBox;
RadioButtonI: TRadioButton;



    - ______________207


  Radi.oBut.ton2: TRadioButton;
Labell: TLabel;
Label2: TLabel;
Buttoni: TButton;
Button2: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations } public
{ Public declarations } end;
type
TPerson=class
fname:string;{  ) constructor Create(name:string);
function info:string; virtual;
end;
TStud=class(TPerson)
fgr:integer; (   }
constructor Create(name:string;gr:integer) ;
function info:string; override;
end;
TProf=class(TPerson)
fdep;string; {   }
constructor Create(name:string;dep:string) ;
function info:string; override;
end;
const
SZL=10; //   var
Fonnl: TFonnl ;
List: arrayn:integer; // -   
implementation
($R *.DFM} constructor TPerson.Create(name:string) ;
begin fname:=name;
end;
constructor TStud.Create(name:string;gr:integer) ;
begin
inherited create(name);



  208______________________Delphi 3.   Object Pascal


  fgr:=gr;
end;
constructor TProf.create(name:string; dep:string) ;
begin
inherited create(name) ;
fdep:=dep;
end;
function TPerson.Info:string;
begin
result:=fname;
end;
function TStud.Info:string;
begin
result:=fname+' rp.'+IntToStr(fgr) ;
end;
function TProf.Info:string;
begin
result:=fname+' .'+fdep;
end;
//     procedure TForml.ButtonlClick(Sender:
TObject) ;
begin
if n"=SZL then begin
if Radiobuttoni.Checked
then //   TStud
ListStrToInt(Edit2.Text)) else
Listn:=n+l;
end else ShowMessage(' !') ;
end;
procedure TFonnl.Button2Click(Sender: TObject);
var
i:integer ;
st:string;
begin
for i:=l to SZL do
if list


    -  209


  ShowMessage(''+#13+st);
end;
end.
   TForml.Buttonlciick,      
  (Buttoni),   iist (RadioButtoni),
 TFormi.Button2dick,      
  (Button2),   info    
( ),  ,    .
     Delphi
   Delphi   , 
    ,   
  ( ,    . .).
       Delphi   
   .     Delphi
    ,    
 :
  type
TFonnl = class(TForm) private
( Private declarations } public
( Public declarations ) end;
var
Fomi: Tfonnl
   , ,    
 -  .
   ,   ,   ,
Delphi    .    
     , Delphi  
     .
   '       
   (),   
  .        
.



   

    

         
 ,     Fioat-ToStrF 
   .
          .
,       
,         
,     ,    
 , ,     ( )
,         .
   . 126      
.
  . 126.      
      Editi, Edit 2 
Edit3.   Labell (    )
   .   
(Buttoni),  (Button2)   (Buttons) .  
      :
          
   .     




  2Y2______________________Delphi 3.   Object Pascal


            "Enter"
       
.   "Enter"      ,
     
    ,  
       onKeypress,
,    ,    , 
  . ,    "Enter" 
     ,    
 -       .
    OnKeyPress  Editi,  Delphi, 
 :
  procedure FonnI.EditlKeyPress(Sender:Tobject;
var Key:Char) ;
begin
end;
  FonnI.EditlKeyPress ,   
     Key.  
 ,   .   
  ,      ( 
   var),     
. ,   ,   
      OnKeypress,
       ,
    chr(O),     
.
        OnKeypress  
 Editi.
  procedure TFormI.EditlKeyPress(Sender: TObject;
var Key: Char) ;
begin
case key of
'0'.. '9', chr (8):;
',': if pos(',',Editi.Text)""0 then key:=chr(0);
'-': if length(Editi.Text)""0 then key:=chr(0);
chr(13): Edit2.SetFocus '.': begin
Mes5ageDlg('   ' +''+#13 +' 
 .',


   ___________________________________213

  mtlnformation,key:=Chr(0);
end else key:=Chr(0) end;
end;
 TFormi.EditKeypress ,   .  
   "BackSpace",     
         
 .   ",",   ,    
  .  ,    
.      "",   
   ,        . 
 "Enter",    setFocus    Edit
2     .
  ,     OnKeypress  
      "Enter",  
  . ,  ,    
      onKeypress, 
   , ,   "Enter"  
     ,     .
    ,   
 sender.
         .
  unit sqroot ;
interface
uses
SyaUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TFonnl = class(TFonn) Labels: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Editi: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Labell: TLabel;
Buttoni: TButton;


  214______________________Delphi 3.   Object Pascal


  Button2: TButton;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure EditKeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations } public
{ Public declarations ) end;

  var
Formi: TFonnl ;
implementation {$R *.DFM)
procedure SqRoot(Editl,Edit2,Edit3:tEdit;Label2:tLabel) ;
label bye;
var
a,b,c:real; //   d:real; // 
xl,x2:real; //   begin
//   
if (Editl.Text=") or (Edit2.Text=") or (Edit3.Text=") then begin
MessageDIg('  '+#13 +' .',
mtWarning,goto bye;
end;
a:=StrToFloat(Editl.text) ;
b:=StrToFloat(Edit2.text) ;
:=StrToFloat(Edit3.text) ;
if a=0 then
begin
Label2.font.color:=clRed;
Label2.caption:=
'   ' +#13+'  !';
end



    ____ __ ___________________215


  else
begin //   //   d:=Sqr(b)-4*a*c;
if d"0 then
begin
Label2.font.color:=clRed;
Label2.caption:=
'  .' +#13+ '   .' end else
begin
//   xl:=(b+Sqrt(d))/(2*a) ;
x2:=(-b+Sqrt(d))/(2*) ;
//   -   Label2.font.color:=clBlack;
Label2.caption:"' :'
+#13+'xl='+FloatToStrF(xl,ffGeneral,7,4)
+#13+'x2='+FloatToStrF(x2,ffGeneral,7,4) end;
end;
bye:
  end;
procedure TFormI.EditKeyPress(Sender: TObject;
var Key: Char);
var
buf:stringbegin
if Sender = Editi then
buf:=Editl.Text else if Sender = Edit2 then
buf:=Edit2.Text else buf:=Edit3.Text;
case key of
''.. '9', chr (8):;
',': if (',',buf)""0 then key:=chr(0);
'-': if length(buf)""0 then key:=chr(0);
chr(13): if Sender= Editi
then Edit2.SetFocus
else if Sender = Edit2



  216______________________Delphi 3.   Object Pascal


  then Edit3.SetFocus else begin
buttoni.SetFocus ;
sqroot(Editl,Edit2,Edit3,Labell) ;
end;
'.': begin
MessageDlg('    ' +''+#13
+'   .', mtlnfonnation,key:=Chr(0);
end else key:=Chr(0) end;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Editl.text:='';
Edit2.text:='';
Edit3.text:='' ;
Labell.font.color:=clBlack;
Labell.caption:='';
Editl.SetFocus;
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Fonnl. Close;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
SqRoot(Editl,Edit2,Edit3,Labell) ;
end;
end
   OnKeypress   Editi  
.    OnKeyPress  Edit2  Edit3
     ,    
    (. 127).
         
FloatToStrF, ,   FloatToStr,     
 . ,    FloatToStr,  
     .



    217


  . 127.        
       :
  s:=FioatTo3trF(, , , };
 s -   ()  ;
 - ,    ;
 -  ,    s;
 -     .
     7     single, 15 
   Double, 18     Extended;
      (. ).
  

ffGeneral
  .     , 
           
    0,00001.      
" " (. )    
FfExponent
 .     d.ddd.. .Esddd,  s - 
""  ""; d -  .    ,
    ,   . 
      
(0..4)
ffFixed
   .    : ddd. ddd. .. 
 ,  ,   , 
 "".        
.       
 (0..18).      ,  
,      




  218______________________Delphi 3.   Object Pascal


  ()


FfNumber
 .        
(ffFixed),       
. ,  45278,34   : 45 278,34
ffCurrency
 .       
    ,   ,
     Windows (. 
       ). 
      


    

          
,    ,    
, . .      .
    (),    
. ,       , 
   .    
 .       , 
       .
      ,  
 .
    
       
  :
  1.        , . .
      .
  2.     .
  3.           
  .
  4.          .
, "", "", ""  "".
  5.      ,   
  .
  6.       , . .  
        .


   _____________________________________219


  7.        . 
 ,       .
   . 128       
  .
  . 128.    
 
    ,   
        
.
       :
  D   D   D  
  ,  , ,   
  , ,   .   
  .     ,  
 .
      :
          
  -.    
    .
      .     
   ,     .
      .   
:

  220 Delphi 3.   Object Pascal


                                100

  

                                85

  

                                60

  

                                50

        .   
 ,       , 
         "
 " (\).       
.     ,     
.     .  
 ,     , 
 ,   ( )   .
        , 
   ,  ,  .
    :
        5, 
  ?
  \tabl.brnp
=(2,4)
,0
=(2:4)
,2
=2++4
.1
         
(      ).   ,   
         .
           
     -.
          
  -.    
    .
      -!
  10
    -,      
.
  7


   ____________________________________221


  , ,      -?
  6
, ,      -?
  5
  :
  Usaak.fcmp   ,0
  ,1
  .0
    1836    
  , :
  \aleks.bmp
   I. ,1
     1812 . .0
   \henn.bnip
  ,0
  ,0
  .0
 ()  -   
    
  
: '1
  
.0
    .0
,     ,   ;
 I, :
  t \bot.bmp I 
I ' I 

                                I '

  
.1



  222______________________Delphi 3.   Object Pascal


      
  ,    -.
  ,0
     - .
  ,1
     -   ().
  .0
    
\faIkone.bmp
 
,1

.0
    I 
 ,1
 .0
(  ^
        Notepad 
Microsoft Word.    Microsoft Word,  
,  ,     .   
        (*.txt).


   


   . 129     Fnnl   
.          
  ,        
  .
    Label 5     , 
     .
   Labeli, Label 2, Labels  Label 4     -
 ,   RadioButtonI, RadioButton2, RadioButton3
 RadioButton4 -   .
    Buttoni    
       .
      ,    Pane ll 
      RadioButton5, 
     .



    223


  . 129.   Test
   .     
   .      
Buttoni   panel!   RadioButton5.  
Panell  Buttoni    RadioButtonS.
  ,  ,       .
  



Border-Icons. biSystemMenu
True
   
Borderlcons.biMinimize
False
  " "
Borderlcons.biMaximize
False
  " "
BorderStyle
bsSingle
  ,    
Caption




  Color
clWhite


  Font. Name
Arial Cyr


  Height

                                362



  Left

                                40



  Name
Fonnl


  Top

                                70



  Width

                                562







  224 Delphi 3.   Object Pascal


      ,    
BorderIcons.biMinimize  Borderlcons.biMaximize   False,
. .         , 
   .      
       .  
BorderStyle        .
    


  Lab"l1
Lab"l2
Labels
Label4
Labels
AutoSize
True
True
True
True
True
Caption
Labell
Label2
Label3
Label4
Label5
Left

                                32

  32

                                32

  32

                                32

  Name
Labell
Label2
Label3
Label4
Label 5
Top

                                64

  96

                                128

  160

                                8

  Wordwrap True True True True True

   


  RadioButtonI
RadloButton2
RadloButton3
RadioButton4
RadioButtonS
Caption










  Left

                                8

  8

                                8

  8

                                8

  Name
RadioButtonI
RadioButton2
RadioButton3
RadioButton4
RadioButton5
Top

                                64

  96

                                128

  160

                                300


     But ton l   pan ell

  Caption
Ok
Height

                                28

  Left

                                13

  Name
Buttoni
Top

                                273

  Width

                                82




  Align
alBottom
Caption


  Name
Panel-)
Height

                                46





    225


   
       image,  
(. 130)    (Additional)  
.
  . 130. 
 Image
,  ,    image.
  

Name
 
Picture
,    TBitmap,   
Left
         
Top
         
Height
 
Width
 
AutoSize 
        
     .   AutoSize 
TRUE,      Picture  
  ,     .   
     AutoSize  FALSE,  
  
Stretch
       ,
          Width 
Height 

      image      
    .      
   picture.     -
  LoadFromFile. ,   
  ,    isaak-bmp (
 ),   :
  Image!.Picture.LoadFromFile('isaak.bmp') ;
,    ,    
 ,    ( ) ,  



  226 Delphi 3.   Object Pascal


    .      - 
      ,      
.        
 ,      , 
    .    .
      ,  
           
 (. 131).

  . 131.   ,    
,       , 
    ,  
    , 
   ,   width  Height 
 .
      imagel    
 Imagel. Picture. Bitmap. Width  Imagel. Picture .Bitmap. Height.
    
        ,
         . ,
      ,  
  ,     test.exe, 
    peterb.txt,      :
          -
peterb.txt,      (.132).
  
,         ,
  .



   _____________________________________227


  . 132.   :  
      ,  
  paramcount ( )   paramstr(n),
     ,  , . 
       
 paramcount  i, a paramstr(i) - peterb.txt.
     ,    
 .
  if ParamCount=0 then begin
ShowMessage('!     .');
goto bye; //    end;
FileName:=ParamStr(l); //     
. 133.   Run parameters



  228______________________Delphi 3.   Object Pascal


    ,    ,  
 Delphi -     Ron
parameters ( )   Ron parameters (. 133),
     Parameters   Run.
   
         
       (. ,
 ).       
.     :   OnActivate 
 ,   onciick    Buttoni, 
   onciick - ,    
.     .
  unit testl_;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
const
N_LEV=4; (    ) N ANS=4; (    } type
TFormI = class(TForm)
//  
Labell: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
// 
Label5: TLabel;
//   
RadioButtonI: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButtonS: TRadioButton;
Buttoni: TButton;
Panell: TPanel;
Imagel: TImage;
procedure FonnActivate(Sender: TObject);

   
procedure ButtonlClick(Sender: TObject);
procedure RadioButtonClick(Sender: TObject);
private
{ Private declarations } public
( Public declarations ) end;
var
Formi: TFonnl; //  f:TextFile;
fn:string; {    )
level:arraymes:arrayscore:arraysumma:integer; (  )
vopros:integer; (    )
n_otv:integer; (    }
otv:integer; {    )
implementation
(      } procedure infofvar
f:TextFile;l:TLabei);
var
s,buf:string;
begin
buf:='';
repeat
readln(f,s) ;
if sthen buf:=buf+s+' ';
until s1.caption:=buf ;
end;
(       } Procedure GetLevel(var
f:TextFile);
var
i:integer ;
buf:string;
begin (     ) i:=l;
repeat
readln(f,buf);
if buf


  230______________________Delphi 3.   Object Pascal


  mesreadin(f,leveli:"i+l;
end;
until bufend;
//   Procedure ScaleImage(Imagel:TImage) ;
var
w,h:integer; //    
scaleX:real; // .   
scaleY.'real; // .   Y
scale:real; //  . 
begin
//      w: =Fonnl.
ClientWidth-10 ;
h:=Fonnl.ClientHeight
  - Fonnl.Panell.Height -5
  - Forml.Label5.Top
  - Fonnl.Label5.Height - 5;
if Formi.Label 1.Caption  ''
then h:=h-Fonnl.Labe11.Height-5;
if Forml.Label2.Caption  ''
then h:=h-Fonnl.Label2.Height-5;
if Fonnl.Label3.Caption "" ''
then h:=h-Fonnl.Label3.Height-5;
if Fonnl.Label4.Caption "" ''
then h:=h-Fonnl.Label4.Height-5;
//   if w"Imagel.Picture.Bitmap.Width then scaleX:=l else
scaleX:=w/Imagel.Picture.Bitmap.Width;
if h"Imagel. Picture. Bitmap. Height then scaleY:=l else
scaleY:=h/Imagel.Picture.Bitmap.Height;
if ScaleY"ScaleX
then scale:=scaleY else scale:=scaleX;
//   
Imagel.Top:=Forml.Label5.Top+Fonnl.Label5.Height+5 ;
Imagel.Width:=Round(Imagel.Picture.Bitmap.Width*scale) ;
Iinagel.Height:=Round(Imagel.Picture.Bitmap.Height*scale) ;
end;



   ___________________________________23?


  //     Procedure VoprosToScr(var
f:TextFiie;fnn:TFonnl;var vopros:integer);
var i:integer;
code:integer;
s,buf:string;
ifn:string; //   begin
vopros:=vopros+l ;
str(vopros:3,s);
fnn.caption:='' + s;
(   } buf:=";
repeat
readln(f,s) ;
if (suntil (sfrm.Labels.caption:=buf;
if sthen Formi.Imagel.Tag:=0 else //     begin
Formi.Imagel.Tag:=1 ;
ifn:=copy(s,2,length(s)) ;
try
Formi.Imagel.Picture.LoadFromFile(ifn);
except
on E:EFOpenError do frm.tag:=0;
end; { try ) end;
//    i:=l;
repeat
buf:=";
repeat //     readln(f,s);
if (suntil (s//    val(scase i of



  232______________________Delphi 3.   Object Pascal


  1: frm.Labell.caption:=buf;
2: f rm.Label2.caption:=buf;
3: frm. Label3.caption:=buf;
4: frm.Label4.caption:=buf;
end;
i:=i+l;
until s//       // 
  
if fnn.Tag =1 //     then begin
Scalelmage(Fonnl.Imagel);
Formi.Imagel.Visible:=TRUE;
end;
//    if Forml.Labell.Caption "" '' then begin
if Formi.Imagel.Tag =1
then frm.Labell.top:=frm.Imagel.Top+frm.Imagel.Height+5 else
frm.Labell.top:=frm.Label5.Top+frm.Label5.Height+5;
frm.RadioButton!.top:=frm.Labell.top;
frm.Labell.visible:=TRUE;
frm.RadioButtonl.visible:=TRUE;
end;
if Fonnl.Label2.Caption  '' then begin
frm.Label2.top:=frm.Labell.top+ frm.Labell.height+5;
frm.RadioButton2.top:=frm.Label2.top;
frm.Label2.visible:=TRUE;
frm.RadioButton2.visible:=TRUE;
end;
if Formi.Label3.Caption  '' then begin
frm.Label3.top:=frm.Label2.top+ frm.Label2.height+5 ;
frm.RadioButton3.top:=frm.Label3.top ;
frm.Label3.visible:=TRUE;
frm.RadioButton3.visible:=TRUE;
end;
if Fonnl.Label4.Caption  '' then begin
frm.Label4.top:=fnn.Label3.top+ frm.Label3.height+5;
frm.RadioButton4.top:=frm.Label4.top;
frm.Label4.visible:=TRUE;



   _____________________________________233


  frm.RadioButton4.visible:=TRUE;
end;
end;
Procedure ResetForm(frm:TForml) ;
begin //      
fnn.Labell.Visible:=FALSE;
frm.Labell.caption:='';
frm.Labell.width:=frm.ClientWidth-frm.Labell.left-5;
frm.RadioButtonl.Visible:=FALSE;
frm.Label2.Visible:"FALSE;
frm.Label2.caption:"'' ;
frm.Label2.width:=frm.ClientWidth-fnn.Label2.1eft-5;
frm.RadioButton2.Visible:=FALSE;
frm.Label3.Visible:-FALSE ;
frm.Label3.caption:='' ;
frm. Label3.width:=frm.ClientWidth-frm.Label3.left-5;
frm.RadioButton3.Visible:=FALSE;
frm.Label4.Visible:"FALSE;
frm.Label4.caption:"'' ;
f rm.Label4.width:=frm.ClientWidth-frm.Label4.1eft-5;
frm.RadioButton4.Visible:=FALSE;
frm.Label5.width:=frm.ClientWidth-frm.Label5.left-5;
f nn.Imagel.Visible:"FALSE;
end;
//    procedure
Itog(sunroa:integer;frm:TFormI) ;
va'r i:integer;
buf:string;
begin buf:=";
str (surnma:5,buf) ;
buf:=' '+chr(13) +' : '+buf;
i:=l;
while (summa " levelbuf:=buf+chr(13)+mesfrm. Label5.caption:=buf;
end;



  234______________________Delphi 3.   Object Pascal


  ($R *.DEM)
procedure TFonnl.FonnActivate(Sender: TObj ect) ;
begin
ResetFom(Formi) ;
if ParamCount = 0 then begin
Label5.font.color:=clRed;
Label5.caption:= 'He    .' ;
Buttonl.caption:"'Ok';
Buttoni.tag:=2 ;
Buttoni.Enabled:=TRUE end else begin
fn:=ParamStr(l) ;
AssignFile(f,fn) ;
($1-) reset(f) ;
(I+) if IOResult=0 then begin
Info(f,Label5); //       GetLevel(f);
//      end;
end;
end;
procedure TFonnl.ButtonlClick(Sender: TObject) ;
begin
case Buttoni.tag of 0: begin
Buttoni.caption:='' ;
Buttoni.tag:=1;
RadioButtonS.Checked:=TRUE ;
(    ) Buttoni.Enabled:=False ;
ResetForm(Formi) ;
VoprosToScr(f,Fonnl,vopros) end;
1: begin (    }
summa:=summa+scoreRadioButton5.Checked:=TRUE;
Buttoni.Enabled:=False ;
ResetForm(Formi) ;
if not eof(f)



    235


  then VoprosToScr(f,Forml,vopros) else
begin
suitima:=suinnia+score closefile(f) ;
Buttoni.caption: =' Ok' ;
Fonnl.caption:='';
Buttoni.tag:=2;
Buttoni.Enabled:=TRUE ;
Itog(summa,Fonnl) ;
end;
end;

  2: begin (   } Fo mil. close;
end;
end; ( case } end;
procedure TFormI.RadioButtonClick(Sender: TObject);
begin
if sender = RadioButtonI then otv:=l
else if sender = RadioButtonI then otv:=2
else if sender = RadioButton3 then otv:=3 else otv:=4;
Buttoni.enabled:=TRUE;
end;
end.

           
 onActivate.  FormActivate   
ResetForm, ,   False  visible,
       . 
     .  , 
      
.
     ,      
-   .     ( paramCount  
  ),     Caption 
Labels        
 tag  Buttoni   2.


  236______________________Delphi 3.   Object Pascal


    ,       .
        
paramStr(l).   ,     
      ,      
    ,    . 
  ,         
,     .     
     .
      .    
AssignFile      .  
    .
        info, 
         
 caption   Label5  .
     GetLevel,     
   .    level  .
     ,   
   Ok (Buttoni).
    Buttoni     
 ( ,      ),  
(   ),    
(    )     (
  ).
   tag  Buttoni    
         Buttoni.
  tag - .     
  tag  ,      Buttoni
   ,    
,   "Ok"    "",  
 RadioButtonS,      
.  ,   Enabled 
But-tc.nl   False,  Buttoni  ,  
       ,   
 .  1  Buttoni. Tag   
     Buttoni.
          (Buttoni),   
 Buttoni. Tag  ,     
    . ,    
,     .   
,     ,    
Buttoni   Buttoni. Tag,    itog
  .



   _____________________________________237


    Buttonl.Tag  ,    close  
Formi   ,     
.
        
voprosToScr.      vopros 
   Caption    
   .       
  ,        
    .     
:       .  
,    ,     ,  
Forml.imagel.Tag       
    .   
  LoadFromFile   imagel. picture.  
     ,    imagel.
visible  False.     
.    ,   
,   Scaieimaga   
  .  ,   imagel. 
       
imagel. visible  True   .   
          
   , ,     
  ,       
    ,    
   .    
  (Labeil)      
  (Labelb) ,     ,  
   (imagel).
          .
      , 
 ,   .  
RadioButtonS,     panel l , ,  .
   OnClick  RadioButtonI, RadioButtor.C.
  RadioButtonS  RadioButton4      -
TForml.RadioButtonClick.      ,
   .     
- ,     
otv,    VoprosToScr   
 .  ,      
  (Buttoni),     
.



  238______________________Delphi 3.   Object Pascal


   itog,       
  level, ,     
   Label5. Caption  
.
   
,          
,         
     .   ^  
      ,   .
  Delphi     ,   
       ,  , 
  .
   . 134     .
  . 134.   , 2
          
,       .
          
 -   ,     
.      
 .
  answer: array     ,  
         
   .



   _____________________________________239


  ,     ondick  
   :
  procedure SeiectorClick(Sender: TObject);
  j
       ,
     . 
     .   
    ,   
        
     .
  ,       ,  
.  -   Delphi,    -  
   , ,       
.     create   
,   ,   . , 
answeranswer       .
         , . .
 ,      ,  Object
Inspector,  .    
    ,  
    .
         .
      , 
    ,     
,   . , 
selector    Ondick  
selectorunit test2_;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TFonnl = class(TForm)



  240______________________Delphi 3.   Object Pascal


  Labels: TLabel; //   
Image 1:  Image; //   
Pane 11:  Panel;
Buttoni: TButton; //  "Ok", "", ""
procedure FormActivate(Sender: TObject);
procedure FonnCreate(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
procedure SelectorClick(Sender: TObject);
private
( Private declarations } public
( Public declarations ) end;
const
N_ANSWERS=4; //    ) N LEVEL=4; //  
 }
var
Formi: TFonnl; // 
answer: arrayf:TextFile;
fn:string; //   
level:arraymes:arrayscore:arraysumma:integer; (  )
vopros:integer; (    }
n otv:integer; {    }
otv:integer; (    }
implementation
(      } Procedure ResetFonn(frm:TFoml) ;
var i:integer;
begin
for i:=l to N_ANSWERS do begin
answeranswerSelectorend;



   ___________________________________241


  frm.Labels.width:=fm.ClientWidth-frm.Label5.1eft-5;
frm.Imagel.Visible:=False;
end;
(    } procedure
Itog(summa:integer;frm:TFormI) ;
var i:integer;
buf .-strings-begin buf:='';
str (sunima: 5, buf) ;
buf:=' '+chr(13) +' : '+buf;
i:=l;
while (sunima " level buf:=buf+chr(13)+mesfrm.Labels.caption:"butt-end;
procedure TForml.FonnCreate(Sender: TObject);
var
i: integer;
begin
//         
for i:=l to N_ftNSWERS do
begin
answeransweransweranswerend;
//     
for i:=l to N_ANSWERS+1 do
begin
selectorselectorselectorselectorselectorselectorselectorselectorend;



  242 _______________Delphi 3.   Object Pascal


  ResetForm(Fonnl);
end;
{      } procedure info(var
f:TextFile;l:TLabel);
var
s,buf:string;
begin
buf:=";
repeat
readln(f,s) ;
if sthen buf:=buf+s+' ';
until sFormi.Label5.caption:=buf;
end;
{       } Procedure GetLevel(var
f:TextFile);
var
i:integer;
buf:strings-begin (     } i: =1 ;
repeat
readln(f,buf) ;
if bufreadin(f,leveli: =i+l ;
end;
until bufend;
//   Procedure ScalePicture;
var
w,h:integer; //    
scaleX:real; // .   
scaleY:real; // .   Y
scale:real; //  . 
i:integer;
begin
//     
w:=Forml.ClientWidth-Formi.Label5.Left ;
h:=Forml.ClientHeight
  - Formi.Panel 1.Height -5



   _____________________________________243


  - Forml.Label5.Top
  - Forml.Label5.Height - 5;
for i:=l to N_ANSWERS do
if answerthen h:=h-answer//    

//   if w"Foml. Imagel. Picture. Width
then scaleX:=l
else scaleX:=w/Forml.Imagel.Picture.Width;
if h"Forml.Imagel.Picture.Height
then scaleY:=l
else scaleY:=h/Forml.Imagel.Picture.Height;
if ScaleYOcaleX
then scale:=scaleY
else scale:=scaleX;
//  
Fonnl.Imagel.Top:=Fonnl.Labels.Top+Fonnl.Labels.Height+S;
Fonnl. Imagel. Left: =Foml. Labels. Left ;
Formi.Imagel.Width:=Round(Fonnl.Imagel.Picture.Width*scale);
Fonnl.Imagel.Height:=Round(Fonnl.Imagel.Picture.Height*scale);
Fonnl.Labels.Visible:=TRUE;
end;
//     Procedure VoprosToScr(var
f:TextFile;fnn:TForml;var vopros:integer);
var i:integer;
code:integer;
s,buf:string;
ifn:string; //   begin
vopros:=vopros+l ;
str(vopros:3,s) ;
fnn.caption:"'' + s;
(   } buf:=";
repeat
readln(f,s) ;
if (suntil (sfnn.Labels.caption:"butt-if sthen //   




  244 _________________Delphi 3.   Object Pascal


  begin
frm. Iinagel. Tag: =1 ;
ifn:=copy(s,2,length(s)) ;
try
fnn.Imagel.Picture.LoadFromFile(ifn) ;
except
on E:EFOpenError do frm.tag:=0;
end { try } end else frm.Imagel.Tag:=0;
//    for i:=l to N_ANSWERS do begin
answeranswerend;
i:=l;
repeat
buf:='';
repeat //     readlntf,s) ;
if .(suntil (s// . 
val(sansweri:=i+l;
until s//     
if Formi. Imagel.Tag =1 //     ? then begin
ScalePicture;
Fonnl.Imagel.Visible:=TRUE ;
end;
//    i:=l;
while (answerif i = 1
then
if frm.Imagel.Tag =1



   _____________________________________245


  then answeranswerseiectorselectoransweri:=i+l;
end;
end;
($R *.DFM)
procedure TForml.FormActivate(Sender: TObject);
begin
ResetForm(Fonnl) ;
if ParamCount = 0 then begin
Labels.font.color:=clRed;
Label5.caption:"'He    .';
Buttoni.caption:='Ok' ;
Buttonl.tag:=2;
Buttoni.Enabled:=TRUE end else'begin
fn:=ParamStr(l) ;
assignfile(f,fn) ;
($1-) reset(f) ;
(I+) if IOResult=0 then begin
Info(f,Label5) ;
GetLevel(f) ;
end;
end;
end;
procedure TFonnl.ButtonlClick(Sender: TObject);
begin
case Buttoni.tag of 0: begin
Buttoni.caption:='' ;
Buttoni.tag:=1 ;
Selector


  246______________________Delphi 3.   Object Pascal


  {    } Buttonl.Enabled:=False;
ResetForm(Forml) ;
VoprosToScr(f,Formi,vopros) end;
1: begin (    ) surnma:=surnma+score
SelectorButtonl.Enabled:=False;
ResetFormtFormi);
if not eof(f)
then VoprosToScr(f,Formi,vopros) else
begin
surnma:=sunTOa+score closefile(f) ;
Buttonl.caption: =' Ok';
Formi.caption:='' ;
Buttonl.tag:=2;
Buttonl.Enabled:=TRUE ;
Itog(summa,Formi);
end;
end;

  2: begin (   ) Formi.Close;
end;
end; ( case ) end;
procedure TForml.SelectorClick(Sender: TObject) ;
var
i:integer ;
begin i:=l;
while selectorotv:=i;
Buttonl.enabled:=TRUE;
end;
end.
       ,   
.   ,    
 ,     
 N ANSWERS.



    


  ,      . 
       ,
   Winhelp,    Windows,
     .
        
  :
           

    
      rtf-, 
     , , Microsoft Word.
       ,   
   ,   1.  ,  
       
(  " ").
           
 (     
 rtf-  -,  ).   
   .    
  .
  

#
   ,    
        
$
  ,      
          
  

   ,       
    ,    





  248 Delphi 3.   Object Pascal


      ,    
          
 .      (. 135)  
    ,     -
.        #     
. 135.   
        #    
      ,    
       
(.136).
  . 136.    ,    
      
     ,   , ,
 TI (topic identifier).
  
        IDH_. 
     rtf-   

     249
   .    ,
     ,    
  .  (),     
  ,      
  .    , , 
       , 
      ,  , 
  ,      .
      .  . 137
       
"",        (
,   ,     
,   #,   _2).
  . 137.       

         
 ,     ,    
        (. 138) 
      -     
  .
   ,      , 
      - ,  
 .        
     . 



  250 Delphi 3.   Object Pascal


      ,   
,    ,    
  ,     .
 #      .  
   :   
  ,     
,       
      .
  . 138.   
   
        (rtf-), 
     .   
  Microsoft Help Workshop,  
  Delphi     Hcw.exe  \HELP\TOOLS
, -    Delphi.
   Microsoft Help Workshop   Windows    Help
Workshop   Tools.
  
   Tools   Help Workshop,   
 Configure Tools,      Tool Options
(. 139)    Add...      Tool
Properties (. 140) :   Title -  Help Workshop,  
Program -     Microsoft Help Workshop. 
      Browse....



     251


          Configure Tools, 
    Help Workshop.   
Tools     Close.
    Help Workshop      
(.141).
        ,    File
  New,      - 
  - Help Project.     
 Project FUe Name.(. 142).
  . 139.   Tool Options
. 140.   Tool Properties
. 141.    Help Workshop



  252 Delphi 3.   Object Pascal


  . 142.   Project File Name
      ,   , 
   ,      
   (rtf-);     
      .   
      (. 143).
  . 143.    
  ,      , 
   ,    
    .
          
(rtf-).       Files,   
Add...    Topic Files.   
     ,  
   rtf-.
           .
      Windows,    Add...
   Window Properties.    



    _____________________________253


     Add a New Window Type (. 144),   Create
a window named
(   )    main     .
  . 144.   Add a New Window Type
    Title bar text  General   
      (. 145).
    Position (. 146),     
  .       Auto-Sizer,
      Help Window Auto-Sizer (. 147),
       .
  . 147.  Help Window Auto-Sizer

  
- ------------------_____Delphi 3.   Object Pascal
SaTa ^0    "^"  . 
^^^^^^^^^^  ^ wndow "10-^
  Color (. 148),      
   (Nonscrolling area color)  ^ 
STchS  010)-   0 er   
Change...        .
  ^^^^^^^^^^    
"^^^^^^^^^^^
^ ^"   ^"-- ^" ' ^ ^^^^^^^^^^^^^^^
    ---- Map -
^^^0^ ^^ "^^  ,     Add.... 
   (. 150)   Topic ID  
  ,    Mapped numeric value
   .
  . 150.   Add Map Entry



     255


   . 151       
 rtf-,      
    .
  . 151.     
        
 Compile   File,     
  Compile a Help File (. 152).
  . 152.   Compile a Help File
        
Automatically display Help file in WinHelp when done ( 
     ), 
   Compile.      
       , 
  ,    .
  
       Save and Compile
   .



  256 Delphi 3.   Object Pascal


    


           
,    Object Inspector   HelpFile 
     ,    HelpContext
- ,     ,  
      "F1" (. 153).
,.
  . 153.     
(,  J
        ,  
   .
         .  ,
 ,       
  "F1",    HelpContext 
.    HelpContext   
,     "F1"    ,  
     .
      ,     
 .        
   Ondick,     winhelp
  Windows Help (WINHELP.EXE).   winhelp
  ,    ,
   , ,  , 
   Windows Help    .
  
    Handle,    
  .



    _____________________________257


      ,   
HELP_CONTEXT.        ,
    .
  ,   ,     ondick 
  (Button4)     
.
  procedure TFonal.Button4Click(Sender: TObject);
begin
winhelp(Foml. Handle, 'sqroot.hip' ,HELP_CONTEXT, 1) ;
end;



  
 


  Delphi      
,         
      ,   
 Delphi.
         
 :
         
   
  
     
       
,   NEdit,     
 .
        
    ,   
 .   ,   
Delphi     ,   
  ,   .  
     .
    

  (  ^

           
  .
     ,    Component  
New Component       New.Component (.
154)     .



  260 Delphi 3.   Object Pascal


  . 154.   New Component
 Ancestor type      
,        
   .    
   Edit ( ).  
      TEdit.
    Class Name      ,
, TNEdit.
    Palette Page     ,   
     .   
   .    Palette Page   
  ,     
     .
    Unit file name     
  . Delphi    ,
    ,    .
      Create Unit    
 Delphi-,    
.     .
  unit NEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TNEdit = class(TEdit) private
( Private declarations ) protected
( Protected declarations )



     261


  public
{ Public declarations } published
{ Published declarations } end;
procedure Register-implementation
procedure Register-begin
RegisterComponents('Samples', end;
end.
          . 
    Register,   
       
Delphi    .
    Delphi      
:    ,      
    , , ,
.         ,
 ,       
   .
      NEdit     .
  // Publised   Single, Double unit nedit;
interface
uses
Windows, Messages, SysOtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TNEdit = class(TEdit) private
( Private declarations }
FNumb:single; // ,    
//    
//    FNumb
function GetNumb:single;



  262______________________Delphi 3.   Object Pascal


  procedure SetNumb(value:single);
protected
{ Protected declarations ) procedure Keypress(var Key: Char); override;
public ( Public declarations }
published
( Published declarations ) constructor Create(AOwner:TComponent); override;
property Numb: single read GetNumb write SetNumb;
end;
procedure Register;
implementation 
procedure Register;
begin
RegisterComponents('Samples',end;
constructor TNEdit.Create(AOwner:TComponent) ;
begin
// don't forget to call the ancestors' constructor
inherited Create(AOwner) ;
end;
function TNEdit.GetNumb:singlet-begin
try
Result:=StrToFloat(text) ;
except
on EConvertError do begin
Result:=0;
text:='' ;
end;
end;
end;
procedure TNEdit.SetNumb(Value:single) ;
begin
FNumb:=Value;



     263


  Text:=FloatToStr(value);
end;
procedure TMEdit.Keypress(var key:char);
begin
case key of
'0'.. '9', #8, :;
(         - 
}
',': if Pos(',',text)""0 then key:=#0;
'-': if Length(text)""0 then key:=#0;
else key:=#0;
end;
inherited Keypress(key) ;
end;
end.
     TNEdit    Numb, 
  ,    .  
  Numb   FNumb.  GetNumb 
    FNumb,   setNumb -   
.
    TNEdit    
 (TEdit),    Text,  
  Numb.
    NEdit     
  TNEdit.Keypress,   
  .    TNEdit.Keypres.s 
  .      OnKeypress
       . 
    NEdit  ( ,  , 
 ""   "Enter"),      .
  (  ^
         
 .    ,    ,
         
.       ,  
 Windows (. 155).
  , ,    Windows ,    
   -  (    ), 



  264 Delphi 3.   Object Pascal



           ,
,  12.34,    
p:=StrToFloat(Editi.Text)
  ,      
Windows   StrToFloat,   ,  
 . (, -    Real, a Editi -
     .)
. 155.   Windows :   
  
        
.     ,  
.
           ,
    .      
  ,      .
      :   ,
 -  .
       NEdit   .156.



     _______________________265


  . 156.     NEdit
      .   - 
,   (   )   
,    .   
 NEdit,   ,       
,        .
         Delphi  
   :
  1.        

2.     ,   public declaration,
   
3.        oncreate,
       
   
      NEdit.
  unit test_u;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
NEdit, StdCtrls;
type
TFonnl = class(TForm) Labell: TLabel;
Buttoni: TButton;
Label2: TLabel;
procedure ForrnCreatefSender: TObject);
procedure ButtonlClick(Sender: TObject);
private
( Private declarations }



  266 Delphi 3.   Object
Pascal


  public
( Public declarations } end;
var
Fonnl: TFormI ;
n:TNedit;
implementation
($R *.DFM}
procedure TFormI.FormCreate(Sender: TObject);
begin
n:=TNEdit.Create(self) ;
n.parent:=self;
n.left:=150;
n.top:=10;
end;
procedure TFormI.ButtonlClick(Sender: TObject);
begin
labell.caption:=FloatToStr(n.numb);
end;
end.
        FormCreate
(, )    ,  
    self, ,  
   .   
     :
   parent  .     
   ,   parent 
 self.
   
     ,   
     (Packages)  Delphi. 
 -     DPK (Delphi PacKage file). ,
  dclstd30.dpk    Delphi.
       , Delphi  
    ,     
  . ,     
     ,  - DCR



     267


  (Dynamic Component Resourse).  ,   
,   ,     .
     
        Image Editor,
    Image Editor   Tools.
     ,    File   New. ,
  ,    - Component Resourse File
(.157).

  . 157.    

  . 158.      

      Resourse    New,   
   - Bitmap.      
   Bitmap Properties    
,     ( 24  24
,   - 16)      (. 158).
           
  -     Bitmapl.     
 (Bitmapl)     , 
 ,     Image Editor, 
 .
        .   
  View   Zoom In.
  
     "" .  
,   ,     
 Delphi  .
          ,
      .   
 ,        
 (Bitmapl),  Rename,      "Enter".
         ,  
  Save   File.



  268______________________Delphi 3.   Object Pascal


  (  ^
       ,   
 .
   . 159    Image Editor,    
  TNEdit.
  . 159.  Image Editor
      ,     
    ,     -  
 .
   
        . 
    Component   Install Component  
     (. 160).
  . 160.   InstoH Component



    __________________________269


   Unit file name (  )     
,       , 
   Browse...,      .
   Search path ( )     
  ,   Delphi    
   ,  ,   . 
     Unit file name     
,     Browse...,  Delphi 
   Search path  ,    
.
  (  ^
      ?  
   Search path.    ,   
    .
   Package file name    ,   
 .    
    dclusr30.dpk.
   Package description    .  
dclusr30.dpk  : Delphi User's Components ( 
Delphi).
           
 .      Confirm (. 161), 
 Delphi    : Package ... will be
rebuilt. Continue? (...  . ?).
    Yes   .   
,       (. 162) 
,        , 
      ,   
.
           Package, 
 ,    ,   .



  270_____________________Delphi 3.   Object Pascal


       ,   
       (.163).
  . 163.  Samples    NEdit
   
     ,    
  () ,    
   (      
  ).    Delphi  :
  The package already contains unit named... (   ,
 ...)    .   
         
      ,   
  ,    .
   
          
    .
  (  ^
        , 
  ,      
,    .
   ,    ,    
       
    Object Inspector   
,   ,      .
     NEdit ,  ,
,   "   ( ),
     . 164.
           
    ,    
 . ,    -



    __________________________271


        ,    Object
Inspector ,      
TNEdit,        (   
   Edit)  - Numb (. 165).
  . 164.    . 165.  
   ( ) TNEdit   Object
Inspector
        (
).
  unit TestOfComp_u;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, nedit;
type
TCompTestFm = class(TForm) Labels: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Roots: TLabel;
CalcBtn: TButton; (  "" } NewBtn: TButton; ( 
"" } CloseBtn: TButton; (  "" } a: TNEdit;
b: TNEdit;
c: TNEdit;
procedure CalcBtnClick(Sender: TObject);



    __________________________271


        ,    Object
Inspector ,      
TNEdit,        (   
   Edit)  - Numb (. 165).
  . 164.    . 165.  
   ( ) TNEdit   Object
Inspector
        (
).
  unit TestOfComp_u;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, nedit;
type
TCompTestFm = class(TForra) Labels: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Roots: TLabel;
CalcBtn: TButton; (  "" } NewBtn: TButton; ( 
"" ) CloseBtn: TButton; {  "" } a: TNEdit;
b: TNEdit;
c: TNEdit;
procedure CalcBtnClick(Sender: TObject);



  272_____________________Delphi 3.   Object Pascal


  procedure NewBtnClick(Sender: TObject);
procedure CloseBtnClick(Sender: TObject);
procedure FonnActivate(Sender: TObject);
procedure aKeyPress(Sender: TObject; var Key: Char);
procedure bKeyPress(Sender: TObject; var Key: Char);
procedure cKeyPress(Sender: TObject; var Key: Char);
private
( Private declarations }
public
( Public declarations }
end;
var
CompTestFnn: TConipTeatFnn;
implementation ($R *.DFM)
procedure SqRoot(a,b,c:tNEdit;Roots:tLabel) ;
( a,b,c -   } var
d:real; (  } xl,x2:real; (   } begin
if a.Numb = 0 then begin Roots.font.color:"cIRed;
Roots.caption:"
' .  ' +#13+'  !';
end else begin (   )
(   ) d:=Sqr(b.Numb)-4*.Numb*c.Numb;
if d"0 then begin
(Label2.color:=clRed;) Roots.font.color:"cIRed;
Roots.caption:= '  .'+#13+ '  
.' end else begin
{   ) xl:=(b.Numb+Sqrt(d))/(2*a.Numb) ;
x2:=(-b.Numb+Sqrt(d))/(2*a.Numb) ;
{   -  } Roots.font.color:=clBlack;



    __________________________273


  Roots.caption:"' :' +#13+'xl='+FloatToStr(xl)
+#13+'x2='+FloatToStr(x2) ;
end;
end;
end;
procedure TCoinpTestFnn.NewBtnClick(Sender: TObject);
begin
a.text:=";
b.text:=";
c.text:"'';
Roots. font. color: =clBlack;
Roots.caption:='' ;
a.Set Focus;
end;
procedure TCompTestFrm.CloseBtnClick(Sender: TObject);
begin
Closet-end;
procedure TConpTestFrm.CalcBtnClick(Sender: TObject);
begin
SqRoot(a,b,c,Roots);
end;
procedure TCoinpTestFrm.FonnActivate(Sender: TObject);
begin
a.SetFocus;
end;
procbdure TConpTestFrm.aKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then b.SetFocus;
end;
procedure TConpTestFnn.bKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then c.SetFocus;
end;
procedure TCompTestFnn.cKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then begin
SqRoot(a,b,c,Roots);



  274 Delphi 3.   Object Pascal


  CalcBtn.SetFocus ;
end;
end;
end.


   

          .
     ,    Component  
Install Packages ( ),    (. 166), 
 Design packages,       
 Edit....
  . 166.    
  ,     Close this dialog and open...
(     ...),     Yes. 
      (. 167),  
  Contains ()   .
      ,      
   Remove.
  
        Remove 
   ,     
  Compile.    Delphi  
,       (. 168).



     275



  . 167.  

  . 168.  

         , 
   ,     .
    
Delphi      .  
"  ,    Component   Configure
Palette,   Palette    Environment
Options (. 169)   Pages  ,  
 ,      Rename.
       Rename page ( )
          (.170).
    Palette   Environment Options, 
      . , 
,   System    Standard,   
Pages         
  Move Up ( ),   
       (



  276 Delphi 3.   Object Pascal


   Move Down ( )     
 ,   ).
  . 169.  Palette   Environment Options
. 170.   Rename page



  


  ,    ,     
,    ,  
  Object Pascal  Delphi.   ,
    Internet-,  , 
   (DDE)    , 
  .   ,    ,
        
Delphi  .
    ,      ,  
 ,     ,    
    ,    "" 
         
-,   , , 
 . ,     "",  
   (   ).    
  ,     !
   .       
    . , 
    "  ...", "
  ...",  ,   
     . , ,
.       ,  
    .   , 
,      . 
   , -,  (. 
 "  ").
       ,   
  ,   .    
!



  


   Pascal ( )  
    .   
       .
  unit ;
interface //   (    
   ,      }
const //   
(      ,  
    }
type //   
(      ,  
     }
var //    {  
  .  ,  
   
 }
implementation //   (    
  ) end.
    
    Pascal :
     D    

  D  (char)
D  (string)
   (boolean)
           
.
   


  



  Shortint
- 128..127


  Integer
- 32 768..32 767


  Longint
- 2 147 483 648..2 147 483 647


  Byte
0..255


  Word
0..65 535



     


 
Real
2.9e-39.. 1.738
11-12
Single
1.5-45..3.438

                                7-8

  Double
5.0-324.. 1.7308
15-16
Extended
3.4-4932.. 1.14932
19-20

  
 1.
  :string;
 -  256 !  2.
  : string  -  .



  _________________________________________281


  

    :
  : array   :
  : array 12. . .2} of 

 1.
  : record !:1;
.2;2;
HoneJ: TwiJ;
end;
 2. type
   .=1 !:1;
2;2;
noneJ:TunJ;
end;
var
^:;
   .   -.


  

   if
 1.
  if  then begin
(  ,  , } {    } end

  282 Delphi 3.   Object
Pascal
else
begin
(  ,  , } (    } end;
 2.
  if  then
begin
(  ,  , } {    ) end;
  ^
  begin  end    ,   begin 
end   .
   case
 1.
  case  of
1_: begin
(  ) end;
2 : begin
{  } end;
 J__KOHCTBHT: begin
(  } end;
end;
 2.
  case  of
! : begin
(  1} end;
2 : begin
{  2} end;



  ________________________________________283


  "._: begin
(  J) end;
else
begin
{  } end;
end;
  begin  end ,    
case      .    ,
    begin  end,   else.
    ^
  begin  end    ,   begin 
end   .
  
 for
 1 (   ).
  for :=1 to  do begin
{   } end;
  begin  end  ( -
-ɣ) + 1 .
    ,  ,   
begin  end  .
  (  ^
  begin  end    ,   begin 
end   .
   2 (   ).
  for := downto  do begin
(   } end;
  begin  end  ( -
) + 1 .



  284_____________________Delphi 3.   Object Pascal


    ,  ,   
begin  end  .
  (  ^
  begin  end    ,   begin 
end   .
   repeat
repeat
begin
(  )
end until ;
   ,    begin 
end.     ,     False,
     .     ,   
 .
    ^)
  begin  end    ,   begin 
end   .
   while
while  do begin
(  } nd;
 ,   ,    
begin  end.    ,     .
  (  ^
  begin  end    ,   begin 
end   .
     GoTo
GoTo ;
    ,    .
      label.



   285


   

  Function ( !: 1:
  var 2: 2;
var  J: TunJ) : ;
const
(   ) var
{   ) begin
(   }
Result:";
end;
 
Procedure ( !: !;
var 2:2;
var ^. KwrJ);
const
(   ) var
(   ) begin
{   } end;.
     
       :
        
    .    
 ,     .
     ,   
  var.     
         ,
 



  286 Delphi 3.   Object Pascal


  


  {)
   (   )
5{)
  (   )
5(: real): real
  
81(:1):1

(: real): real

1(:1):1

(: real) :1

^(: real): real

   

  


  lnt( : real): real
 
\1(: real): long int
 
Round(6b/paxeHHe:real):longint
   
1.1:()
      
()
     
FloatToStrF(Bb/paxeHMe, , , )
        
 
StrTolnt(Crpo"a: string)
 ,     ,  
s trToFloat( : string)
 ,   ,  

       
Concat(  1: string, ... ,Crpcwa/V:string):string 
   
Copy(Crpo;(a;string,/-/oMepCt"Mso/7a;integer,  
): string




  ________________________________________^7


  Delete(var CrpoKa:srting, /-/oMepCnMBo/7a:integer, : integer)
  
Length( : string): integer
 
(: string, : string):byte
   
(/"/7:1)
   


     Windows


   Windows  ,   ANSI. 
 ANSI,    ,  Windows-1251.
    :
    

                                9

  

                                11

   

                                13

   

                                32

  

     32-127:
  32 44 , 56 8 68 D

                                33

  !
  45
-

                                57

  9

                                69

  

                                34

  "

                                46



  58


  70
F

                                35

  #

                                47

  /

                                59

  ',

                                71

  G

                                36

  $

                                48

  0

                                60

  "

                                72

  

                                37

  %

                                49

  1

                                61

  =

                                73

  I

                                38

  &

                                50

  2

                                62

  "

                                74

  J

                                39

  

                                51

  3

                                63

  ?
  75


                                40

  (

                                52

  4

                                64

  @

                                76

  L

                                41

  )

                                53

  5

                                65

  

                                77

  

                                42

  *

                                54

  6

                                66

  

                                78

  N

                                43

  +

                                55

  7

                                67

  

                                79

  0



  285_____________________Delphi 3.   Object Pascal


  80


                                92

  \

                                104

  h

                                116

  t

                                81

  Q

                                93

  ]

                                105

  i

                                117

  U

                                82

  R

                                94

  ^

                                106

  i

                                118

  V

                                83

  S

                                95



  107
k

                                119

  W

                                84

  

                                96

  

                                108

  I

                                120

  X

                                85

  U

                                97

  

                                109

  m

                                121

  

                                86

  V

                                98

  b

                                110

  n

                                122

  z ,

                                87

  W

                                99

  

                                111

  

                                123

  88

                                X

  100
d

                                112

  P

                                124

  I

                                89

  Y

                                101

  e

                                113

  q

                                125

  ]

                                90

  Z

                                102

  f

                                114

  

                                126

  ~

                                91

  103

                                9

  115
s

                                127




     192-255:


  192


                                208

  P

                                224

  

                                240

  P

                                193

  

                                209

  

                                225

  6

                                241

  

                                194

  

                                210

  

                                226

  

                                242

  

                                195

  

                                211

  

                                227

  

                                243

  

                                196

  

                                212

  

                                228

  

                                244

  

                                197

  

                                213

  X

                                229

  e

                                245

  X

                                198

  

                                214

  

                                230

  

                                246

  

                                199

  3

                                215

  

                                231

  3

                                247

  

                                200

  

                                216

  

                                232

  

                                248

  

                                201

  

                                217

  

                                233

  

                                249

  

                                202

  

                                218

  b

                                234

  

                                250

  

                                203

  

                                219

  

                                235

  

                                251

  

                                204

  

                                220

  b

                                236

  

                                252

  

                                205

  

                                221

  

                                237

  

                                253

  

                                206

  

                                222

  

                                238

  

                                254

  

                                207

  

                                223

  

                                239

  

                                255

  




  _________________________________________259


     
   
        .  
          9.
         
,     .   
   ,    - ,    . .
,  2703  2*1000+7*100+0*10+3*1.
           
  ,   ,   i-ro   i-
 .

         
.        -  
.   ,   . 
  i-ro    i- .

  1*128 + 1*64 +0*32 + 0*16 + 1*8 + 1*4 + 0*2 + 1*1 = 205

(11001101)2= (205)


   
    .      
. ,       -



  290 Delphi 3.   Object Pascal


  .     .  ,  
      -  11111111,  
  255,  - .    
     255.
      .    
    ,      
 .       .
,    char     256 .
        .
   integer     -32 768  32 767
(65 535 ),        .
,      ,     
    (.  ).
   
  ()
 
Char

                                1

   
String

                                256

    256 
String1 *n
   
Byte

                                1

  0..255
Word

                                2

  0..65 535
Integer

                                2

  - 32 768..32 767
Longint

                                4

  - 2 147 483 648..2 147 483 647
Real

                                6

  2.9-39.. 1.738
Single

                                4

  1.5-45..3.438
Double

                                8

  5.0-324.. 1.7308
Extended

                                8

  3.4-4932.. 1.14932

            
   (     
). ,      Day,  
,         byte,
integer  longin.        , 
 - ,   - .     
 ,     . ,   
,       
 .      
   .



  __________________________________291


        ,   
   ,    256 .
 ,     , 
 name:string     ,
     ,    .
,    ,  20  20, 
      (20*20*8=3200).
      ,     
,       ,  
 .


    


  1.  .    : .  . - .: , 1989. -
360 ., .
  2.  .,  .,  .   
: .  . - .: , 1982. - 386 ., .
  3.    : .  ./ . , .
, .   .;  . . , . , . . - .:  
, 1986. - 168 ., .
  4.  .     : .  . - .:
  , 1985. - 368 ., .
  5.  . .  .  .   . . . . -
.: , 1989. - 240 ., .
  6. .   . Delphi 2.   : .  .
  - .: BHV--, 1997. - 784 ., .
  7.  . .,  . . Delphi -  
. - .: BHV--, 1996. - 352 .
  8.   Delphi.  : .  . - .:
  , 1996. - 736 ., .
  9.  .    Windows 95/NT: .  .
  - .: -, 1997. - 640 ., .


   

  
Help-, 250

 I

  Image Editor, 267

 , 122 - , 10


,179
 , 167
 , 95  , 204 
, 179
 , 93

, 199

                                3

  , 176

  
Microsoft Help Workshop, 250
w
Windows Help (winhelp), 256


 , 254 
  , 225
  , 225 , 200 
Case, 75
For, 83
Goto, 90
If, 69
Read, Readin, 95
Repeat... Until, 87
While, 85
with, 178
write, 160
Write, Writein, 93
writein, 160
 , 90
, 95
, 69
 , 75   (Sender), 213

  294
Delphi 3.   Object Pascal



  
, 197
 , 227 , 53 
Image, 225
StrringGrid, 139
, 238
, 259 , 198


, 111
, 110
, 238
, 136
, 109
  , 143
  , 119
  , 119
 , 120
, 132  , 12 
Create, 198
Free, 199
LoadFromFile, 225
SetFocus, 213  , 199

, 198 
,176
, 159 , 18
AND, 69
DIV, 18
MOD, 18
NOT, 69
OR, 69
, 69 ,18 
 , 162

  
 , 266 
, 186
, 185 
, 60 
, 11 
-, 197 
Append, 161
AssignFile, 160
Close, 164
Rewrite, 161
 , 48


, 267
 , 274 , 147 , 266

, 200
HelpContext, 256
HelpFile, 256
Stretch, 225
, 202
, 200 , 101  
 , 239 
   , 190
 , 188
, 187
 , 193 
  , 249 
 Delphi, 64

   _________________________________ 295



  

char, 101
TextFile, 159
, 175
 , 173

, 67

 hip, 247

  
rtf,247
  (DPK), 266   , 251 
, 266  , 247 
FloatToSrtF, 216 lOResult, 163

 For, 83
Repeat... Until, 87 While, 85

  


............................................... 
  ................................ 4
.................................................. 5
 ................................... 7
   ............................... 7
  ...................................... 8
................................................ 11
  OBJECT PASCAL....................... 12
 ............................................... 12
................................................ 14
................................................. 16
 ................................... 17
 ....................................... 20
 ............................................... 22
 .............................................. 23
  Delphi................................. 27
DELPHI -    .............. 31
 DELPHI ......................................... 31
 DELPHI ............................................ 37
   DELPHI.................................... 39
 ............................................. 40
  ......................................... 41
 .......................................... 43
    ..................... 47
  Delphi...................................... 49
 ........................................ 51
 ............................................... 53
    ............... 56
   ...................... 5
   ....................... 58
  ..................................... 61
   Delphi......................... 64
  OBJECT PASCAL....................... 67
 .................................................. 67
 .................................................... 69
 IF............................................. 69
 CASE........................................... 75
..................................................... 82
 FOR............................................ 83
 WHILE.......................................... 85
 REPEAT...UNTIL................................. 87
 GOTO........................................... 90
 -................................... 93
 WRITE  WRITELN................................ 93
 READ  READLN.................................. 95
  .................................... 97
  .......................................... 101
................................................... 101
.................................................... 103
 LENGTH............................................ 105
 DELETE.......................................... 105
 POS............................................... 106
 COPY.............................................. 106
................................................... 109
 ........................................ 109
     .................. 110
 ............................................. 110
 .............................................. 111
  ()  ....... 119
   .......................................... 120
     ... 126
 ........................................ 132
  ...................................... 136
   ......................... 143
.................................................. 147
 .......................................... 147
 :   ............................. 149
 :   .................. 155
................................................ 159
  ......................................... 159
 .......................................... 159
  .............................................. 160
   ................................. 160
  ..................................... 162
 ............................................ 164
 .......................................... 164
............................................... 167
 ............................................ 167
   .................................... 168
 .............................................. 168
 .............................................. 169
  ................................... 170
 ,  ................... 173
 ......................................... 173
 .......................................... 175
.................................................... 176
  .................................... 176
 WITH........................................... 178
     ............................... 179
   ............................ 184
-...................................... 185
 ................................... 186
 .......................................... 187
  - ...... 1?
..................................................... 197
-................................................... 198
..................................................... 199
    .......................... 200
..........-................................... 202
 PROTECTED  PRIVATE. ........................... 203
    ......................... 204
   DELPHI................................... 209
 .......................................... 211
   ............................ 211
   .................................. 218
  .................................... 219
 ................................................ 219
  ......................................... 222
 ......................................... 225
  ...................................... 226
 ........................................... 228
 .............................. 238
  ............................. 247
     .............. 247
    ........................ 250
   ......................... 256
  .......................... 259
      . 259
  ................................ 259
  ............................ 264
 ...................................... 266
   ........................ 267
 ...................................... 268
   ........................... 270
 ................................... 270
 ....................................... 274
   ............................ 275
................................................ 277
................................................ 279
 PASCAL ( ).......................... 279
 .......................................... 279
  ...................................... 279
................................................... 281
.................................................... 281
..................................................... 281
..................................................... 283
  ...................................... 284
 ........................................ 285
 ...................................... 285
   ............................ 285
   WINDOWS.............................. 287
   ..................... 289
  ................... 291
 ...................................... 293
